added search filter by tags
This commit is contained in:
@@ -658,6 +658,28 @@ class ProductSearchTest(TestCase):
|
||||
payload = response.json()
|
||||
self.assertEquals(len(payload['products']), len(expected_instances))
|
||||
|
||||
def test_anon_user_can_filter_by_tags(self):
|
||||
expected_instances = [
|
||||
self.factory(tags="lunares/rojos, deporte", description="zapatos verdes", discount=None),
|
||||
self.factory(tags="lunares/rojos, deporte", discount=0.00),
|
||||
self.factory(tags="deporte", attributes='"zapatos de campo", tono/oscuro', category="ropa", discount=9.00),
|
||||
]
|
||||
unexpected_instances = [
|
||||
self.factory(description="chanclas", tags='rojos'),
|
||||
self.factory(tags="zapatos/azules", category="deporte", description='rojos', discount=12.00),
|
||||
]
|
||||
|
||||
query_string = quote("zapatos rojos")
|
||||
# discount=true
|
||||
url = f"{self.endpoint}?query_string={query_string}&tags=deporte"
|
||||
# send in request
|
||||
response = self.client.get(url)
|
||||
# check response
|
||||
self.assertEqual(response.status_code, 200)
|
||||
# load response data
|
||||
payload = response.json()
|
||||
self.assertEquals(len(payload['products']), len(expected_instances))
|
||||
|
||||
|
||||
class MyProductsViewTest(APITestCase):
|
||||
"""my_products tests
|
||||
|
||||
Reference in New Issue
Block a user