merge resolution
This commit is contained in:
@@ -212,11 +212,11 @@ class ProductViewSetTest(APITestCase):
|
||||
|
||||
# Assert access is granted
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
# TODO: assert correct order
|
||||
previous_date = datetime.datetime.now()
|
||||
for instance in payload:
|
||||
self.assertTrue(datetime.datetime.fromisoformat(instance['created'][:-1]) < previous_date)
|
||||
previous_date = datetime.datetime.fromisoformat(instance['created'][:-1])
|
||||
# assert correct order
|
||||
dates = [d['created'][:-1] for d in payload]
|
||||
for i in range(len(dates)-1):
|
||||
# first instance should be most recent
|
||||
self.assertTrue(datetime.datetime.fromisoformat(dates[i]) > datetime.datetime.fromisoformat(dates[i+1]))
|
||||
|
||||
# authenticated user
|
||||
def test_auth_user_can_list_instances(self):
|
||||
@@ -321,7 +321,7 @@ class ProductViewSetTest(APITestCase):
|
||||
'discount': '0.05',
|
||||
'stock': 22,
|
||||
'tags': ['tag1x, tag2x'],
|
||||
'category': 'MayorTagCategory2',
|
||||
'category': 'mayortagcategory2',
|
||||
'attributes': ['color/blue', 'size/m'],
|
||||
'identifiers': '34rf34f43c43',
|
||||
}
|
||||
@@ -531,9 +531,9 @@ class ProductSearchTest(TestCase):
|
||||
self.factory(tags="azules"),
|
||||
]
|
||||
|
||||
query_string = quote("zapatos rojos")
|
||||
q = quote("zapatos rojos")
|
||||
|
||||
url = f"{self.endpoint}?query_string={query_string}"
|
||||
url = f"{self.endpoint}?q={q}"
|
||||
# send in request
|
||||
response = self.client.get(url)
|
||||
|
||||
@@ -565,10 +565,10 @@ class ProductSearchTest(TestCase):
|
||||
self.factory(tags="azules"),
|
||||
]
|
||||
|
||||
query_string = quote("zapatos rojos")
|
||||
q = quote("zapatos rojos")
|
||||
limit = 2
|
||||
|
||||
url = f"{self.endpoint}?query_string={query_string}&limit=2"
|
||||
url = f"{self.endpoint}?q={q}&limit=2"
|
||||
# send in request
|
||||
response = self.client.get(url)
|
||||
|
||||
@@ -592,9 +592,9 @@ class ProductSearchTest(TestCase):
|
||||
self.factory(tags="lunares/rojos", description="zapatos", shipping_cost=0.00),
|
||||
]
|
||||
|
||||
query_string = quote("zapatos rojos")
|
||||
q = quote("zapatos rojos")
|
||||
# shipping_cost=true
|
||||
url = f"{self.endpoint}?query_string={query_string}&shipping_cost=true"
|
||||
url = f"{self.endpoint}?q={q}&shipping_cost=true"
|
||||
# send in request
|
||||
response = self.client.get(url)
|
||||
# check response
|
||||
@@ -613,10 +613,10 @@ class ProductSearchTest(TestCase):
|
||||
self.factory(tags="azules", shipping_cost=10.00),
|
||||
]
|
||||
|
||||
query_string = quote("zapatos rojos")
|
||||
q = quote("zapatos rojos")
|
||||
|
||||
# shipping_cost=false
|
||||
url = f"{self.endpoint}?query_string={query_string}&shipping_cost=false"
|
||||
url = f"{self.endpoint}?q={q}&shipping_cost=false"
|
||||
# send in request
|
||||
response = self.client.get(url)
|
||||
# check response
|
||||
@@ -636,9 +636,9 @@ class ProductSearchTest(TestCase):
|
||||
self.factory(tags="lunares/rojos", category='zapatos', description="zapatos verdes", discount=None),
|
||||
]
|
||||
|
||||
query_string = quote("zapatos rojos")
|
||||
q = quote("zapatos rojos")
|
||||
# discount=true
|
||||
url = f"{self.endpoint}?query_string={query_string}&discount=true"
|
||||
url = f"{self.endpoint}?q={q}&discount=true"
|
||||
# send in request
|
||||
response = self.client.get(url)
|
||||
# check response
|
||||
@@ -658,9 +658,9 @@ class ProductSearchTest(TestCase):
|
||||
self.factory(tags="azules", discount=9.00),
|
||||
]
|
||||
|
||||
query_string = quote("zapatos rojos")
|
||||
q = quote("zapatos rojos")
|
||||
# discount=true
|
||||
url = f"{self.endpoint}?query_string={query_string}&discount=false"
|
||||
url = f"{self.endpoint}?q={q}&discount=false"
|
||||
# send in request
|
||||
response = self.client.get(url)
|
||||
# check response
|
||||
@@ -680,9 +680,8 @@ class ProductSearchTest(TestCase):
|
||||
self.factory(tags="azules"),
|
||||
]
|
||||
|
||||
query_string = quote("zapatos rojos")
|
||||
# discount=true
|
||||
url = f"{self.endpoint}?query_string="
|
||||
url = f"{self.endpoint}?q="
|
||||
# send in request
|
||||
response = self.client.get(url)
|
||||
# check response
|
||||
@@ -702,9 +701,9 @@ class ProductSearchTest(TestCase):
|
||||
self.factory(tags="zapatos/azules", category="deporte", description='rojos', discount=12.00),
|
||||
]
|
||||
|
||||
query_string = quote("zapatos rojos")
|
||||
q = quote("zapatos rojos")
|
||||
# discount=true
|
||||
url = f"{self.endpoint}?query_string={query_string}&category=ropa"
|
||||
url = f"{self.endpoint}?q={q}&category=ropa"
|
||||
# send in request
|
||||
response = self.client.get(url)
|
||||
# check response
|
||||
@@ -724,9 +723,9 @@ class ProductSearchTest(TestCase):
|
||||
self.factory(tags="zapatos/azules", category="deporte", description='rojos', discount=12.00),
|
||||
]
|
||||
|
||||
query_string = quote("zapatos rojos")
|
||||
q = quote("zapatos rojos")
|
||||
# discount=true
|
||||
url = f"{self.endpoint}?query_string={query_string}&tags=deporte"
|
||||
url = f"{self.endpoint}?q={q}&tags=deporte"
|
||||
# send in request
|
||||
response = self.client.get(url)
|
||||
# check response
|
||||
@@ -746,8 +745,8 @@ class ProductSearchTest(TestCase):
|
||||
self.factory(tags="lunares/rojos", category='zapatos', description="zapatos verdes", price=None),
|
||||
]
|
||||
price_min = 5.00
|
||||
query_string = quote("zapatos rojos")
|
||||
url = f"{self.endpoint}?query_string={query_string}&price_min={price_min}"
|
||||
q = quote("zapatos rojos")
|
||||
url = f"{self.endpoint}?q={q}&price_min={price_min}"
|
||||
# send in request
|
||||
response = self.client.get(url)
|
||||
|
||||
@@ -770,8 +769,8 @@ class ProductSearchTest(TestCase):
|
||||
self.factory(tags="lunares/rojos", category='zapatos', description="zapatos verdes", price=100.00),
|
||||
]
|
||||
price_max = 50.00
|
||||
query_string = quote("zapatos rojos")
|
||||
url = f"{self.endpoint}?query_string={query_string}&price_max={price_max}"
|
||||
q = quote("zapatos rojos")
|
||||
url = f"{self.endpoint}?q={q}&price_max={price_max}"
|
||||
# send in request
|
||||
response = self.client.get(url)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user