Skip to content

Commit

Permalink
inttest try 2
Browse files Browse the repository at this point in the history
  • Loading branch information
AvangardAA committed Oct 27, 2023
1 parent c2e7c12 commit 3a28b75
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions tests/e2e/e2e_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,26 +83,25 @@ async def test_get_reports_200(self):
self.fail("Response is not valid JSON")

async def test_get_reports_V2_200(self):
async with httpx.AsyncClient() as client:

response = await client.get(
"http://127.0.0.1:8000/api/report?report_name=dummy&ffrom=2023-19-10-07:00&to=2023-23-10-07:00&ver=2")

if response.status_code == 307:
location = response.headers.get("Location")
response = await client.get(location)

data = response.text

if response.status_code != 200:
self.assertEqual(response.status_code, 404)
else:
try:
parsed_data = json.loads(data)
self.assertIsInstance(parsed_data, list)
self.assertTrue(len(parsed_data) == 2)
except json.JSONDecodeError:
self.fail("Response is not valid JSON")
async with httpx.AsyncClient() as client:
response = await client.get(
"http://127.0.0.1:8000/api/report?report_name=dummy&ffrom=2023-19-10-07:00&to=2023-23-10-07:00&ver=2")

if response.status_code == 307:
location = response.headers.get("Location")
response = await client.get(location)

data = response.text

if response.status_code != 200:
self.assertEqual(response.status_code, 404)
else:
try:
parsed_data = json.loads(data)
self.assertIsInstance(parsed_data, list)
self.assertTrue(len(parsed_data) == 2)
except json.JSONDecodeError:
self.fail("Response is not valid JSON")

def test_start_get200_fail(self):
asyncio.run(self.test_get_reports_307_then_200_then_fail())
Expand Down

0 comments on commit 3a28b75

Please sign in to comment.