Skip to content
Snippets Groups Projects
Commit a652da9b authored by VignaRamaNaga ManikantaSwamy Akula's avatar VignaRamaNaga ManikantaSwamy Akula
Browse files

Issue #35 CRS Catalog query_with_cursor needed made changes in python test cases

parent 3104367b
No related branches found
No related tags found
1 merge request!322Resolve "CRS Catalog query_with_cursor needed"
Pipeline #224729 failed
......@@ -128,6 +128,20 @@ class TestCrsCatalog(unittest.TestCase):
time.sleep(10)
@staticmethod
def check_get_search_response_count(response, expected_count, test_name):
response_body = json.loads(response.content)
assert response.status_code == 200
response_count = len(response_body["searchResults"]["results"])
for test_response in response_body["searchResults"]["results"]:
if test_response["id"] not in record_id_set:
response_count -= 1
if response_count != expected_count:
print(f'Error: Test {test_name} Expects {expected_count} records. Got {response_count} records.')
assert response_count == expected_count
@staticmethod
def check_search_response_count(response, expected_count, test_name):
response_body = json.loads(response.content)
assert response.status_code == 200
......@@ -146,7 +160,7 @@ class TestCrsCatalog(unittest.TestCase):
test_data = json.loads(test_data_file.read().replace('{{data_partition_id}}', constants.MY_TENANT))
response = self.client.make_request('GET', f'{ct_endpoint_path}?dataId={test_data["dataId"]}')
response_body = json.loads(response.content)
self.check_search_response_count(response, 1, "test_get_coordinate_transformation_dataId")
self.check_get_search_response_count(response, 1, "test_get_coordinate_transformation_dataId")
assert response_body["searchResults"]["results"][0]["id"] == test_data["recordId"]
assert response_body["searchResults"]["results"][0]["data"]["ID"] == test_data["dataId"]
for record_property in ('kind', 'version', 'acl', 'legal', 'namespace'):
......@@ -161,7 +175,7 @@ class TestCrsCatalog(unittest.TestCase):
test_data = json.loads(test_data_file.read().replace('{{data_partition_id}}', constants.MY_TENANT))
response = self.client.make_request('GET', f'{ct_endpoint_path}?recordId={test_data["recordId"]}')
response_body = json.loads(response.content)
self.check_search_response_count(response, 1, "test_get_coordinate_transformation_recordId")
self.check_get_search_response_count(response, 1, "test_get_coordinate_transformation_recordId")
assert response_body["searchResults"]["results"][0]["id"] == test_data["recordId"]
assert response_body["searchResults"]["results"][0]["data"]["ID"] == test_data["dataId"]
......@@ -171,7 +185,7 @@ class TestCrsCatalog(unittest.TestCase):
response = self.client.make_request('GET',
f'{ct_endpoint_path}?dataId={test_data["dataId"]}&recordId={test_data["recordId"]}')
response_body = json.loads(response.content)
self.check_search_response_count(response, 1, "test_get_coordinate_transformation_dataId_recordId")
self.check_get_search_response_count(response, 1, "test_get_coordinate_transformation_dataId_recordId")
assert response_body["searchResults"]["results"][0]["id"] == test_data["recordId"]
assert response_body["searchResults"]["results"][0]["data"]["ID"] == test_data["dataId"]
......@@ -180,7 +194,7 @@ class TestCrsCatalog(unittest.TestCase):
test_data = json.loads(test_data_file.read().replace('{{data_partition_id}}', constants.MY_TENANT))
response = self.client.make_request('GET', f'{crs_endpoint_path}?dataId={test_data["dataId"]}')
response_body = json.loads(response.content)
self.check_search_response_count(response, 1, "test_get_coordinate_reference_system_dataId")
self.check_get_search_response_count(response, 1, "test_get_coordinate_reference_system_dataId")
assert response_body["searchResults"]["results"][0]["id"] == test_data["recordId"]
assert response_body["searchResults"]["results"][0]["data"]["ID"] == test_data["dataId"]
for record_property in ('kind', 'version', 'acl', 'legal', 'namespace'):
......@@ -195,7 +209,7 @@ class TestCrsCatalog(unittest.TestCase):
test_data = json.loads(test_data_file.read().replace('{{data_partition_id}}', constants.MY_TENANT))
response = self.client.make_request('GET', f'{crs_endpoint_path}?recordId={test_data["recordId"]}')
response_body = json.loads(response.content)
self.check_search_response_count(response, 1, "test_get_coordinate_reference_system_recordId")
self.check_get_search_response_count(response, 1, "test_get_coordinate_reference_system_recordId")
assert response_body["searchResults"]["results"][0]["id"] == test_data["recordId"]
assert response_body["searchResults"]["results"][0]["data"]["ID"] == test_data["dataId"]
......@@ -205,7 +219,7 @@ class TestCrsCatalog(unittest.TestCase):
response = self.client.make_request('GET',
f'{crs_endpoint_path}?dataId={test_data["dataId"]}&recordId={test_data["recordId"]}')
response_body = json.loads(response.content)
self.check_search_response_count(response, 1, "test_get_coordinate_reference_system_dataId_recordId")
self.check_get_search_response_count(response, 1, "test_get_coordinate_reference_system_dataId_recordId")
assert response_body["searchResults"]["results"][0]["id"] == test_data["recordId"]
assert response_body["searchResults"]["results"][0]["data"]["ID"] == test_data["dataId"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment