Skip to content

Commit

Permalink
Refactor test_parse_results_positive_count to test_parse_results_coun…
Browse files Browse the repository at this point in the history
…t_over_zero and add test_search_by_size_async
  • Loading branch information
apmnt committed Mar 3, 2024
1 parent 3adfb07 commit fbf464f
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tests/baseservicetestclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_fetch_code_200(self):
# Assert that the status code is 200
self.assertEqual(res.status_code, 200)

def test_parse_results_positive_count(self):
def test_parse_results_count_over_zero(self):

sparams = SearchParams("comme des garcons")
res = self.service.fetch_data(sparams.get_dict())
Expand All @@ -54,3 +54,19 @@ def test_search_by_size(self):
# Loop through the items and assert the size is XL
for i in range(searchresults.count()):
self.assertTrue(size_to_search in searchresults.get(i)["size"])

def test_search_by_size_async(self):

size_to_search = "XL"
sparams = SearchParams("comme des garcons", sizes=[size_to_search])
res = asyncio.run(self.service.fetch_data_async(sparams.get_dict()))
items = asyncio.run(self.service.parse_response_async(res))
searchresults = SearchResults(items)
sizes = "Listing sizes:\n"
for i in range(searchresults.count()):
sizes += "Size: " + searchresults.get(i)["size"] + "\n"
self.logger.info(sizes)

# Loop through the items and assert the size is XL
for i in range(searchresults.count()):
self.assertTrue(size_to_search in searchresults.get(i)["size"])

0 comments on commit fbf464f

Please sign in to comment.