serialized tags working
This commit is contained in:
@@ -118,7 +118,7 @@ class ProductViewSetTest(APITestCase):
|
||||
'discount': '0.05',
|
||||
'stock': 22,
|
||||
'tags': ['tag1, tag2'],
|
||||
# 'category': '',
|
||||
'category': 'Mr',
|
||||
'attributes': ['color/red', 'size/xxl'],
|
||||
'identifiers': '34rf34f43c43',
|
||||
}
|
||||
@@ -129,7 +129,6 @@ class ProductViewSetTest(APITestCase):
|
||||
|
||||
# Query endpoint
|
||||
response = self.client.post(self.endpoint, data=data, format='json')
|
||||
import ipdb; ipdb.set_trace()
|
||||
# Assert endpoint returns created status
|
||||
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
|
||||
|
||||
@@ -188,13 +187,36 @@ class ProductViewSetTest(APITestCase):
|
||||
# Create instances
|
||||
instance = self.factory()
|
||||
|
||||
# Define request data
|
||||
company = CompanyFactory()
|
||||
data = {
|
||||
'company': company.id,
|
||||
'sku': 'qwerewq',
|
||||
'name': 'qwerewq',
|
||||
'description': 'qwerewq',
|
||||
'url': 'http://qwerewq.com',
|
||||
'price': '12.21',
|
||||
'shipping_cost': '21.12',
|
||||
'shipping_terms': 'qwerewq',
|
||||
'source': 'SYNCHRONIZED',
|
||||
'sourcing_date': datetime.datetime.now().isoformat()+'Z',
|
||||
'update_date': datetime.datetime.now().isoformat()+'Z',
|
||||
'discount': '0.05',
|
||||
'stock': 22,
|
||||
'tags': ['tag1, tag2'],
|
||||
'category': 'Mr',
|
||||
'attributes': ['color/red', 'size/xxl'],
|
||||
'identifiers': '34rf34f43c43',
|
||||
}
|
||||
|
||||
# Authenticate user
|
||||
token = get_tokens_for_user(self.user)
|
||||
self.client.credentials(HTTP_AUTHORIZATION=f"Bearer {token['access']}")
|
||||
|
||||
# Query endpoint
|
||||
url = self.endpoint + f'{instance.pk}/'
|
||||
response = self.client.put(url, data={}, format='json')
|
||||
response = self.client.put(url, data=data, format='json')
|
||||
|
||||
|
||||
# Assert endpoint returns OK code
|
||||
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
|
||||
|
||||
Reference in New Issue
Block a user