diff --git a/cdrhook/server.py b/cdrhook/server.py index d6187a8..c15d422 100644 --- a/cdrhook/server.py +++ b/cdrhook/server.py @@ -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 @@ -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", [ ]) diff --git a/tests/test_cdrhook/test_retrieve.py b/tests/test_cdrhook/test_retrieve.py index d7f8ce8..0f50eea 100644 --- a/tests/test_cdrhook/test_retrieve.py +++ b/tests/test_cdrhook/test_retrieve.py @@ -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 @@ -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' diff --git a/tests/test_cdrhook/test_server.py b/tests/test_cdrhook/test_server.py index 3c052c8..5409e56 100644 --- a/tests/test_cdrhook/test_server.py +++ b/tests/test_cdrhook/test_server.py @@ -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)