def test_handle_json_message(ga_ls8c_ard_3_message, ga_ls8c_ard_3_yaml): actual_doc, uri = handle_json_message(ga_ls8c_ard_3_message, None, "STAC-LINKS-REL:odc_yaml") assert type(actual_doc) is dict assert ga_ls8c_ard_3_yaml["id"] == actual_doc["id"] assert ga_ls8c_ard_3_yaml["crs"] == actual_doc["crs"] assert ga_ls8c_ard_3_yaml["product"]["name"] == actual_doc["product"][ "name"] assert ga_ls8c_ard_3_yaml["label"] == actual_doc["label"] # Test geometry field doc_diff = deep_diff(ga_ls8c_ard_3_yaml["geometry"], actual_doc["geometry"]) assert doc_diff == {}, pformat(doc_diff) # Test grids field doc_diff = deep_diff(ga_ls8c_ard_3_yaml["grids"]["default"], actual_doc["grids"]["default"]) assert doc_diff == {}, pformat(doc_diff) # Test measurements field doc_diff = deep_diff( ga_ls8c_ard_3_yaml["measurements"], actual_doc["measurements"], exclude_paths=["root['nbart_panchromatic']"], ) assert doc_diff == {}, pformat(doc_diff)
def test_odc_metadata_link(ga_ls8c_ard_3_message): actual_doc, uri = handle_json_message(ga_ls8c_ard_3_message, None, "STAC-LINKS-REL:odc_yaml") assert ( uri == "http://dea-public-data-dev.s3-ap-southeast-2.amazonaws.com/" "analysis-ready-data/ga_ls8c_ard_3/088/080/2020/05/25/" "ga_ls8c_ard_3-1-0_088080_2020-05-25_final.odc-metadata.yaml")
def test_stac_link(ga_ls8c_ard_3_message): metadata, uri = handle_json_message(ga_ls8c_ard_3_message, stac_transform, None) assert (uri != "http://dea-public-data.s3-ap-southeast-2.amazonaws.com/" "baseline/ga_ls8c_ard_3/088/080/2020/05/25/" "ga_ls8c_ard_3-1-0_088080_2020-05-25_final.odc-metadata.yaml") assert (uri == "http://dea-public-data.s3-ap-southeast-2.amazonaws.com/" "baseline/ga_ls8c_ard_3/088/080/2020/05/25/" "ga_ls8c_ard_3-1-0_088080_2020-05-25_final.stac-item.json")
def test_transform(ga_ls8c_ard_3_message, ga_ls8c_ard_3_yaml): actual_doc, uri = handle_json_message(ga_ls8c_ard_3_message, stac_transform, None) assert ga_ls8c_ard_3_yaml["id"] == actual_doc["id"] assert ga_ls8c_ard_3_yaml["crs"] == actual_doc["crs"] assert ga_ls8c_ard_3_yaml["product"]["name"] == actual_doc["product"][ "name"] assert ga_ls8c_ard_3_yaml["label"] == actual_doc["label"] # Test geometry field doc_diff = deep_diff(ga_ls8c_ard_3_yaml["geometry"], actual_doc["geometry"]) assert doc_diff == {}, pformat(doc_diff) # Test grids field doc_diff = deep_diff(ga_ls8c_ard_3_yaml["grids"], actual_doc["grids"]) assert doc_diff == {}, pformat(doc_diff) # Test measurements field doc_diff = deep_diff(ga_ls8c_ard_3_yaml["measurements"], actual_doc["measurements"]) assert doc_diff == {}, pformat(doc_diff) # Test properties field doc_diff = deep_diff( ga_ls8c_ard_3_yaml["properties"], actual_doc["properties"], exclude_paths=[ "root['odc:product']", "root['datetime']", "root['dtr:start_datetime']", "root['dtr:end_datetime']", "root['odc:processing_datetime']", "root['proj:epsg']", "root['proj:shape']", "root['proj:transform']", ], ) assert doc_diff == {}, pformat(doc_diff)