unified the db queries in product search, one per chunk
This commit is contained in:
@@ -462,7 +462,9 @@ class ProductSearchTest(TestCase):
|
||||
def test_anon_user_can_search(self):
|
||||
expected_instances = [
|
||||
self.factory(description="zapatos verdes"),
|
||||
self.factory(tags="colores/rojos"),
|
||||
self.factory(tags="colores/rojos, "),
|
||||
self.factory(description="zapatos rojos"),
|
||||
self.factory(attributes='"lunares rojos", '),
|
||||
]
|
||||
unexpected_instances = [
|
||||
self.factory(description="chanclas"),
|
||||
@@ -476,10 +478,11 @@ class ProductSearchTest(TestCase):
|
||||
url = f"{self.endpoint}?query_string={query_string}"
|
||||
# send in request
|
||||
response = self.client.get(url)
|
||||
payload = response.json()
|
||||
# check response
|
||||
self.assertEqual(response.status_code, 200)
|
||||
# check for object creation
|
||||
self.assertEquals(len(response.data['products']), len(expected_instances))
|
||||
self.assertEquals(len(payload['products']), len(expected_instances))
|
||||
|
||||
|
||||
class MyProductsViewTest(APITestCase):
|
||||
|
||||
Reference in New Issue
Block a user