hide private items from friends in search
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
93335b2776
commit
f4894d3a8c
4 changed files with 38 additions and 11 deletions
|
|
@ -38,7 +38,7 @@ class InventoryApiTestCase(UserTestMixin, InventoryTestMixin, ToolshedTestCase):
|
|||
|
||||
def test_post_new_item(self):
|
||||
reply = client.post('/api/inventory_items/', self.f['local_user1'], {
|
||||
'availability_policy': 'friends',
|
||||
'availability_policy': 'rent',
|
||||
'category': 'cat2',
|
||||
'name': 'test3',
|
||||
'description': 'test',
|
||||
|
|
@ -50,7 +50,7 @@ class InventoryApiTestCase(UserTestMixin, InventoryTestMixin, ToolshedTestCase):
|
|||
self.assertEqual(reply.status_code, 201)
|
||||
self.assertEqual(InventoryItem.objects.count(), 3)
|
||||
item = InventoryItem.objects.get(name='test3')
|
||||
self.assertEqual(item.availability_policy, 'friends')
|
||||
self.assertEqual(item.availability_policy, 'rent')
|
||||
self.assertEqual(item.category, Category.objects.get(name='cat2'))
|
||||
self.assertEqual(item.name, 'test3')
|
||||
self.assertEqual(item.description, 'test')
|
||||
|
|
@ -61,7 +61,7 @@ class InventoryApiTestCase(UserTestMixin, InventoryTestMixin, ToolshedTestCase):
|
|||
|
||||
def test_post_new_item2(self):
|
||||
reply = client.post('/api/inventory_items/', self.f['local_user1'], {
|
||||
'availability_policy': 'friends',
|
||||
'availability_policy': 'share',
|
||||
'name': 'test3',
|
||||
'description': 'test',
|
||||
'owned_quantity': 1,
|
||||
|
|
@ -70,7 +70,7 @@ class InventoryApiTestCase(UserTestMixin, InventoryTestMixin, ToolshedTestCase):
|
|||
self.assertEqual(reply.status_code, 201)
|
||||
self.assertEqual(InventoryItem.objects.count(), 3)
|
||||
item = InventoryItem.objects.get(name='test3')
|
||||
self.assertEqual(item.availability_policy, 'friends')
|
||||
self.assertEqual(item.availability_policy, 'share')
|
||||
self.assertEqual(item.category, None)
|
||||
self.assertEqual(item.name, 'test3')
|
||||
self.assertEqual(item.description, 'test')
|
||||
|
|
@ -80,7 +80,7 @@ class InventoryApiTestCase(UserTestMixin, InventoryTestMixin, ToolshedTestCase):
|
|||
|
||||
def test_post_new_item_empty(self):
|
||||
reply = client.post('/api/inventory_items/', self.f['local_user1'], {
|
||||
'availability_policy': 'friends',
|
||||
'availability_policy': 'rent',
|
||||
'owned_quantity': 1,
|
||||
'image': '',
|
||||
})
|
||||
|
|
@ -89,7 +89,7 @@ class InventoryApiTestCase(UserTestMixin, InventoryTestMixin, ToolshedTestCase):
|
|||
|
||||
def test_post_new_item3(self):
|
||||
reply = client.post('/api/inventory_items/', self.f['local_user1'], {
|
||||
'availability_policy': 'friends',
|
||||
'availability_policy': 'private',
|
||||
'name': 'test3',
|
||||
'description': 'test',
|
||||
'owned_quantity': 1,
|
||||
|
|
@ -99,7 +99,7 @@ class InventoryApiTestCase(UserTestMixin, InventoryTestMixin, ToolshedTestCase):
|
|||
self.assertEqual(reply.status_code, 201)
|
||||
self.assertEqual(InventoryItem.objects.count(), 3)
|
||||
item = InventoryItem.objects.get(name='test3')
|
||||
self.assertEqual(item.availability_policy, 'friends')
|
||||
self.assertEqual(item.availability_policy, 'private')
|
||||
self.assertEqual(item.category, None)
|
||||
self.assertEqual(item.name, 'test3')
|
||||
self.assertEqual(item.description, 'test')
|
||||
|
|
@ -109,7 +109,7 @@ class InventoryApiTestCase(UserTestMixin, InventoryTestMixin, ToolshedTestCase):
|
|||
|
||||
def test_put_item(self):
|
||||
reply = client.put('/api/inventory_items/1/', self.f['local_user1'], {
|
||||
'availability_policy': 'friends',
|
||||
'availability_policy': 'sell',
|
||||
'name': 'test4',
|
||||
'description': 'new description',
|
||||
'owned_quantity': 100,
|
||||
|
|
@ -121,7 +121,7 @@ class InventoryApiTestCase(UserTestMixin, InventoryTestMixin, ToolshedTestCase):
|
|||
self.assertEqual(reply.status_code, 200)
|
||||
self.assertEqual(InventoryItem.objects.count(), 2)
|
||||
item = InventoryItem.objects.get(id=1)
|
||||
self.assertEqual(item.availability_policy, 'friends')
|
||||
self.assertEqual(item.availability_policy, 'sell')
|
||||
self.assertEqual(item.category, None)
|
||||
self.assertEqual(item.name, 'test4')
|
||||
self.assertEqual(item.description, 'new description')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue