added food api view tests
This commit is contained in:
@ -11,10 +11,10 @@ class TestApiUnit(TestViews):
|
||||
def setUp(self):
|
||||
super(TestApiUnit, self).setUp()
|
||||
self.unit_1 = Unit.objects.create(
|
||||
name='Beef'
|
||||
name='kg'
|
||||
)
|
||||
self.unit_2 = Unit.objects.create(
|
||||
name='Chicken'
|
||||
name='g'
|
||||
)
|
||||
|
||||
def test_keyword_list(self):
|
||||
@ -33,11 +33,11 @@ class TestApiUnit(TestViews):
|
||||
response = json.loads(r.content)
|
||||
self.assertEqual(len(response), 1)
|
||||
|
||||
r = self.user_client_1.get(f'{reverse("api:unit-list")}?query=Pork')
|
||||
r = self.user_client_1.get(f'{reverse("api:unit-list")}?query=m')
|
||||
response = json.loads(r.content)
|
||||
self.assertEqual(len(response), 0)
|
||||
|
||||
r = self.user_client_1.get(f'{reverse("api:unit-list")}?query=Beef')
|
||||
r = self.user_client_1.get(f'{reverse("api:unit-list")}?query=kg')
|
||||
response = json.loads(r.content)
|
||||
self.assertEqual(len(response), 1)
|
||||
|
||||
|
Reference in New Issue
Block a user