Skip to content

Commit

Permalink
Updated tests, minor tweak to debug statment
Browse files Browse the repository at this point in the history
  • Loading branch information
abodeuis committed Aug 19, 2024
1 parent 1026746 commit 693b6b6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
12 changes: 9 additions & 3 deletions cdrhook/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,11 @@ def process_cog(cdr_connector : CdrConnector , cog_id : str, config_parm : Optio
legend_response = retrieve.retrieve_cog_legend_items(cdr_connector, cog_id, system_id=systemid, validated="false")
cog_legend_items = retrieve.validate_cog_legend_items_response(legend_response)
if cog_legend_items:
break
logging.debug(f"Cog-{cog_id[0:8]} - Found {len(cog_legend_items)} legend items")
break
if cog_legend_items is not None:
logging.debug(f"Cog-{cog_id[0:8]} - Found {len(cog_legend_items)} legend items")
else:
logging.debug(f"Cog-{cog_id[0:8]} - No legend items found")

# checking for area, logic will be:
cog_area_extraction = None
Expand All @@ -225,7 +228,10 @@ def process_cog(cdr_connector : CdrConnector , cog_id : str, config_parm : Optio
cog_area_extraction = retrieve.validate_cog_area_extraction_response(area_response)
if cog_area_extraction:
break
logging.debug(f"Cog-{cog_id[0:8]} - Found {len(cog_area_extraction)} area items")
if cog_area_extraction is not None:
logging.debug(f"Cog-{cog_id[0:8]} - Found {len(cog_area_extraction)} area items")
else:
logging.debug(f"Cog-{cog_id[0:8]} - No area items found")

# check what models to fire
firemodels = parameters.get("model", [ ])
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cdrhook/test_retrieve.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_retrieve_cog_area_extraction(self):
def test_retrieve_cog_area_extraction_by_system_id(self):
log = init_test_log('TestRetrieveCog/test_retrieve_cog_area_extraction_by_system_id')
cog_id = "5a06544690b6611f419f0c6f244776a536ad52915555555555515545c9b1ddb9"
test_system = SystemId(name='uncharted', version='0.0.4')
test_system = SystemId(name='uncharted-area', version='0.0.4')
response_data = rt.retrieve_cog_area_extraction(self.con, cog_id, system_id=test_system)
cog_area_extraction = rt.validate_cog_area_extraction_response(response_data)
# Save Response
Expand Down Expand Up @@ -85,7 +85,7 @@ def test_retrieve_cog_legend_items(self):
def test_retrieve_cog_legend_items_by_system_id(self):
log = init_test_log('TestRetrieveCog/test_retrieve_cog_legend_items_by_system_id')
test_system = SystemId(name='polymer', version='0.0.1')
response_data = rt.retrieve_cog_legend_items(self.con, self.cog_id, system_id=test_system)
response_data = rt.retrieve_cog_legend_items(self.con, self.cog_id, system_id=test_system, validated='true')
cog_legend_items = rt.validate_cog_legend_items_response(response_data)
# Save Response
json_path = 'tests/logs/TestRetrieveCog/test_cog_legend_items_by_system_id.json'
Expand Down
1 change: 1 addition & 0 deletions tests/test_cdrhook/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def test_process_cog(self):
config["mode"] = 'test'
config["prefix"] = os.getenv("PREFIX")
config["callback_url"] = 'http://fakeurl.com'
config['systems'] = {'area' : ['uncharted-area'], 'legend' : ['polymer']}
with open("cdrhook/models.json", "r") as f:
config["models"] = json.load(f)

Expand Down

0 comments on commit 693b6b6

Please sign in to comment.