history sync created when adding products from csv
This commit is contained in:
@@ -283,15 +283,18 @@ class LoadCoopProductsTestCase(APITestCase):
|
||||
# test CSV file path
|
||||
self.csv_path = 'datasets/test_products.csv'
|
||||
|
||||
def test_admin_can_load_csv(self):
|
||||
def test_auth_user_with_company_can_load_csv(self):
|
||||
# delete existing instances
|
||||
self.model.objects.all().delete()
|
||||
|
||||
# create company
|
||||
company = CompanyFactory(creator=self.user)
|
||||
|
||||
# read csv file
|
||||
files = {'csv_file': open(self.csv_path,'rt')}
|
||||
|
||||
# Authenticate
|
||||
token = get_tokens_for_user(self.admin_user)
|
||||
token = get_tokens_for_user(self.user)
|
||||
self.client.credentials(HTTP_AUTHORIZATION=f"Bearer {token['access']}")
|
||||
|
||||
# send in request
|
||||
@@ -302,7 +305,7 @@ class LoadCoopProductsTestCase(APITestCase):
|
||||
# check for object creation
|
||||
self.assertEquals(5, self.model.objects.count())
|
||||
|
||||
def test_auth_user_cannot_load_csv(self):
|
||||
def test_auth_user_with_no_company_cannot_load_csv(self):
|
||||
# delete existing instances
|
||||
self.model.objects.all().delete()
|
||||
|
||||
@@ -364,7 +367,6 @@ class ProductSearchTest(TestCase):
|
||||
url = f"{self.endpoint}?query_string={query_string}"
|
||||
# send in request
|
||||
response = self.client.get(url)
|
||||
import ipdb; ipdb.set_trace()
|
||||
|
||||
# check re sponse
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
Reference in New Issue
Block a user