diff --git a/swh/indexer/tests/test_metadata.py b/swh/indexer/tests/test_metadata.py --- a/swh/indexer/tests/test_metadata.py +++ b/swh/indexer/tests/test_metadata.py @@ -7,6 +7,7 @@ import unittest from hypothesis import HealthCheck, given, settings, strategies +import pytest from swh.indexer.codemeta import CODEMETA_TERMS from swh.indexer.metadata import ContentMetadataIndexer, RevisionMetadataIndexer @@ -405,7 +406,10 @@ }, ) - def test_detect_metadata_package_json(self): + @pytest.mark.parametrize( + "filename", [b"package.json", b"Package.json", b"PACKAGE.json", b"PACKAGE.JSON"] + ) + def test_detect_metadata_package_json(self, filename): # given df = [ { @@ -421,7 +425,7 @@ }, { "sha1_git": b"aab", - "name": b"package.json", + "name": filename, "target": b"aab", "length": 712, "status": "visible", @@ -436,29 +440,7 @@ expected_results = {"NpmMapping": [b"cde"]} # then - self.assertEqual(expected_results, results) - - def test_detect_metadata_package_uppercase_npm(self): - # given - df = [ - { - "sha1git": b"def", - "name": b"PACKAGE.json", - "target": b"def", - "length": 897, - "status": "visible", - "type": "file", - "perms": 33188, - "dir_id": b"dir_a", - "sha1": b"xyz", - }, - ] - # when - results = detect_metadata(df) - - expected_results = {"NpmMapping": [b"xyz"]} - # then - self.assertEqual(expected_results, results) + assert expected_results == results def test_detect_metadata_codemeta_json_uppercase(self): # given