From 5fccba78e5a109c4289414a66212ae63e1cbab6e Mon Sep 17 00:00:00 2001 From: Viktor Bozhinov Date: Mon, 24 Jan 2022 17:54:29 +0000 Subject: [PATCH] test: unit test method for getting ICAT relations of PaNOSC non-related fields #265 --- test/search_api/test_panosc_mappings.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/search_api/test_panosc_mappings.py b/test/search_api/test_panosc_mappings.py index d64a589b..ff309a49 100644 --- a/test/search_api/test_panosc_mappings.py +++ b/test/search_api/test_panosc_mappings.py @@ -96,3 +96,26 @@ def test_invalid_get_panosc_non_related_field_names( ): with pytest.raises(FilterError): test_panosc_mappings.get_panosc_non_related_field_names("UnknownEntity") + + @pytest.mark.parametrize( + "test_panosc_entity_name, expected_icat_relations", + [ + pytest.param("Affiliation", [], id="Affiliation"), + pytest.param("Dataset", [], id="Dataset"), + pytest.param("Document", ["type", "keywords"], id="Document"), + pytest.param("File", [], id="File"), + pytest.param("Instrument", ["facility"], id="Instrument"), + pytest.param("Member", [], id="Member"), + pytest.param("Parameter", ["type", "type"], id="Parameter"), + pytest.param("Person", [], id="Person"), + pytest.param("Sample", ["parameters.type"], id="Sample"), + pytest.param("Technique", [], id="Technique"), + ], + ) + def test_get_icat_relations_for_panosc_non_related_fields( + self, test_panosc_mappings, test_panosc_entity_name, expected_icat_relations, + ): + icat_relations = test_panosc_mappings.get_icat_relations_for_panosc_non_related_fields( # noqa: B950 + test_panosc_entity_name, + ) + assert icat_relations == expected_icat_relations