Skip to content

Commit

Permalink
fix: total size test case
Browse files Browse the repository at this point in the history
  • Loading branch information
wphyojpl committed Jan 16, 2025
1 parent 148e592 commit 86b8160
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion tests/integration_tests/test_uds_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,27 @@ def test_granules_get(self):
headers=headers,
)
response_json = json.loads(query_result.text)
print(json.dumps(response_json, indent=4))
# print(json.dumps(response_json, indent=4))
print(f"length: {len(response_json['features'])}")
self.assertEqual(query_result.status_code, 200, f'wrong status code. {query_result.text}')
total_size = response_json['numberMatched']['total_size']
current_size = len(response_json['features'])
links = {k['rel']: k['href'] for k in response_json['links'] if k['rel'] != 'root'}
for k, v in links.items():
self.assertTrue(v.startswith(self.uds_url), f'missing stage: {self.stage} in {v} for {k}')

while len(response_json['features']) > 0:
get_next_link = [k['href'] for k in response_json['links'] if k['rel'] == 'next']
get_next_link = get_next_link[0]
print(get_next_link)
query_result = requests.get(url=get_next_link,
headers=headers,
)
response_json = json.loads(query_result.text)
self.assertEqual(query_result.status_code, 200, f'wrong status code. {query_result.text}')
current_size += len(response_json['features'])
print(f"length: {len(response_json['features'])}")
self.assertEqual(total_size, current_size, f'mismatched size')
return

def test_single_granule_get(self):
Expand Down

0 comments on commit 86b8160

Please sign in to comment.