diff --git a/.github/workflows/fossologytests.yml b/.github/workflows/fossologytests.yml index 35064fa..f0abec1 100644 --- a/.github/workflows/fossologytests.yml +++ b/.github/workflows/fossologytests.yml @@ -10,7 +10,7 @@ on: jobs: test-latest: - name: Integration Tests (latest Fossology - 4.3.0) + name: Integration Tests (latest Fossology - 4.x) runs-on: ubuntu-latest container: @@ -20,7 +20,7 @@ jobs: services: fossology: - image: fossology/fossology:4.3.0 + image: fossology/fossology:latest ports: - 8081:80 volumes: diff --git a/tests/test_items.py b/tests/test_items.py index 35b45e0..dd05da5 100644 --- a/tests/test_items.py +++ b/tests/test_items.py @@ -10,14 +10,12 @@ from fossology.obj import FileInfo, Upload -@pytest.mark.skip(reason="Not yet released, waiting for API version 1.6.0") def test_item_info(foss: Fossology, upload_with_jobs: Upload): files, _ = foss.search(license="BSD") info: FileInfo = foss.item_info(upload_with_jobs, files[0].uploadTreeId) assert info.meta_info["fileUploadOrigin"] == "base-files_11.tar.xz" -@pytest.mark.skip(reason="Not yet released, waiting for API version 1.6.0") def test_item_info_with_unknown_item_raises_api_error( foss: Fossology, upload_with_jobs: Upload ): @@ -26,7 +24,6 @@ def test_item_info_with_unknown_item_raises_api_error( assert f"Upload {upload_with_jobs.id} or item 1 not found" in str(excinfo.value) -@pytest.mark.skip(reason="Not yet released, waiting for API version 1.6.0") @responses.activate def test_item_info_500_error( foss: Fossology, foss_server: str, upload_with_jobs: Upload @@ -39,12 +36,11 @@ def test_item_info_500_error( with pytest.raises(FossologyApiError) as excinfo: foss.item_info(upload_with_jobs, 1) assert ( - f"API error while getting info for item 1 from upload {upload_with_jobs.uploadname}." + f"API error while getting info for item 1 from upload {upload_with_jobs.uploadname}" in excinfo.value.message ) -@pytest.mark.skip(reason="Not yet released, waiting for API version 1.6.0") def test_item_copyrights(foss: Fossology, upload_with_jobs: Upload): files, _ = foss.search(license="BSD") num_copyrights = foss.item_copyrights( @@ -53,7 +49,6 @@ def test_item_copyrights(foss: Fossology, upload_with_jobs: Upload): assert num_copyrights == 0 -@pytest.mark.skip(reason="Not yet released, waiting for API version 1.6.0") def test_item_copyrights_with_unknown_item_raises_api_error( foss: Fossology, upload_with_jobs: Upload ): @@ -62,7 +57,6 @@ def test_item_copyrights_with_unknown_item_raises_api_error( assert f"Upload {upload_with_jobs.id} or item 1 not found" in str(excinfo.value) -@pytest.mark.skip(reason="Not yet released, waiting for API version 1.6.0") @responses.activate def test_item_copyrights_500_error( foss: Fossology, foss_server: str, upload_with_jobs: Upload @@ -80,14 +74,12 @@ def test_item_copyrights_500_error( ) -@pytest.mark.skip(reason="Not yet released, waiting for API version 1.6.0") def test_upload_get_clearing_history(foss: Fossology, upload_with_jobs: Upload): files, _ = foss.search(license="BSD") history = foss.get_clearing_history(upload_with_jobs, files[0].uploadTreeId) assert not history -@pytest.mark.skip(reason="Not yet released, waiting for API version 1.6.0") def test_upload_get_clearing_history_with_unknown_item_raises_api_error( foss: Fossology, upload_with_jobs: Upload ): @@ -96,7 +88,6 @@ def test_upload_get_clearing_history_with_unknown_item_raises_api_error( assert f"Upload {upload_with_jobs.id} or item 1 not found" in str(excinfo.value) -@pytest.mark.skip(reason="Not yet released, waiting for API version 1.6.0") @responses.activate def test_upload_get_clearing_history_500_error( foss: Fossology, foss_server: str, upload_with_jobs: Upload @@ -114,14 +105,12 @@ def test_upload_get_clearing_history_500_error( ) -@pytest.mark.skip(reason="Not yet released, waiting for API version 1.6.0") def test_upload_get_bulk_history(foss: Fossology, upload_with_jobs: Upload): files, _ = foss.search(license="BSD") history = foss.get_bulk_history(upload_with_jobs, files[0].uploadTreeId) assert not history -@pytest.mark.skip(reason="Not yet released, waiting for API version 1.6.0") def test_upload_get_bulk_history_with_unknown_item_raises_api_error( foss: Fossology, upload_with_jobs: Upload ): @@ -130,7 +119,6 @@ def test_upload_get_bulk_history_with_unknown_item_raises_api_error( assert f"Upload {upload_with_jobs.id} or item 1 not found" in str(excinfo.value) -@pytest.mark.skip(reason="Not yet released, waiting for API version 1.6.0") @responses.activate def test_upload_get_bulk_history_500_error( foss: Fossology, foss_server: str, upload_with_jobs: Upload @@ -148,7 +136,6 @@ def test_upload_get_bulk_history_500_error( ) -@pytest.mark.skip(reason="Not yet released, waiting for API version 1.6.0") def test_upload_schedule_bulk_scan( foss: Fossology, upload_with_jobs: Upload, foss_bulk_scan_spec: dict ): @@ -162,7 +149,6 @@ def test_upload_schedule_bulk_scan( assert history[0].addedLicenses == ["MIT"] -@pytest.mark.skip(reason="Not yet released, waiting for API version 1.6.0") def test_schedule_bulk_scan_with_unknown_item_raises_api_error( foss: Fossology, upload_with_jobs: Upload, foss_bulk_scan_spec: dict ): @@ -171,7 +157,6 @@ def test_schedule_bulk_scan_with_unknown_item_raises_api_error( assert f"Upload {upload_with_jobs.id} or item 1 not found" in str(excinfo.value) -@pytest.mark.skip(reason="Not yet released, waiting for API version 1.6.0") @responses.activate def test_schedule_bulk_scan_500_error( foss: Fossology, @@ -192,14 +177,12 @@ def test_schedule_bulk_scan_500_error( ) -@pytest.mark.skip(reason="Not yet released, waiting for API version 1.6.0") def test_upload_get_prev_next(foss: Fossology, upload_with_jobs: Upload): files, _ = foss.search(license="BSD") prev_next = foss.get_prev_next(upload_with_jobs, files[0].uploadTreeId) assert prev_next -@pytest.mark.skip(reason="Not yet released, waiting for API version 1.6.0") def test_upload_get_prev_next_with_licenses(foss: Fossology, upload_with_jobs: Upload): files, _ = foss.search(license="BSD") prev_next = foss.get_prev_next( @@ -208,7 +191,6 @@ def test_upload_get_prev_next_with_licenses(foss: Fossology, upload_with_jobs: U assert prev_next -@pytest.mark.skip(reason="Not yet released, waiting for API version 1.6.0") def test_upload_get_prev_next_no_clearing(foss: Fossology, upload_with_jobs: Upload): files, _ = foss.search(license="BSD") prev_next = foss.get_prev_next( @@ -217,7 +199,6 @@ def test_upload_get_prev_next_no_clearing(foss: Fossology, upload_with_jobs: Upl assert prev_next -@pytest.mark.skip(reason="Not yet released, waiting for API version 1.6.0") def test_upload_get_prev_next_with_unknown_item_raises_api_error( foss: Fossology, upload_with_jobs: Upload ): @@ -226,7 +207,6 @@ def test_upload_get_prev_next_with_unknown_item_raises_api_error( assert f"Upload {upload_with_jobs.id} or item 1 not found" in str(excinfo.value) -@pytest.mark.skip(reason="Not yet released, waiting for API version 1.6.0") @responses.activate def test_upload_get_prev_next_500_error( foss: Fossology, foss_server: str, upload_with_jobs: Upload diff --git a/tests/test_search.py b/tests/test_search.py index 4d3fdc7..2e5a389 100644 --- a/tests/test_search.py +++ b/tests/test_search.py @@ -12,29 +12,19 @@ from fossology.obj import Upload -# See: https://github.com/fossology/fossology/pull/2390 -@pytest.mark.skip( - reason="current Fossology version has a bug, /search is not supported, fixed in 4.3.0" -) def test_search_nogroup(foss: Fossology): with pytest.raises(FossologyApiError) as excinfo: foss.search(searchType=SearchTypes.ALLFILES, filename="GPL%", group="test") - assert "Searching for group test not authorized" in str(excinfo.value) + assert "Unable to get a result with the given search criteria" in str(excinfo.value) -@pytest.mark.skip( - reason="current Fossology version has a bug, /search is not supported, fixed in 4.3.0" -) def test_search(foss: Fossology, upload: Upload): - search_result = foss.search(searchType=SearchTypes.ALLFILES, filename="GPL%") + search_result, _ = foss.search(searchType=SearchTypes.ALLFILES, filename="GPL%") assert search_result -@pytest.mark.skip( - reason="current Fossology version has a bug, /search is not supported, fixed in 4.3.0" -) def test_search_nothing_found(foss: Fossology, upload: Upload): - search_result = foss.search( + search_result, _ = foss.search( searchType=SearchTypes.ALLFILES, filename="test%", tag="test", @@ -46,22 +36,16 @@ def test_search_nothing_found(foss: Fossology, upload: Upload): assert search_result == [] -@pytest.mark.skip( - reason="current Fossology version has a bug, /search is not supported, fixed in 4.3.0" -) def test_search_directory(foss: Fossology, upload: Upload): - search_result = foss.search( - searchType=SearchTypes.DIRECTORIES, + search_result, _ = foss.search( + searchType=SearchTypes.DIRECTORY, filename="share", ) - assert search_result + assert not search_result -@pytest.mark.skip( - reason="current Fossology version has a bug, /search is not supported, fixed in 4.3.0" -) def test_search_upload(foss: Fossology, upload: Upload): - search_result = foss.search( + search_result, _ = foss.search( searchType=SearchTypes.ALLFILES, upload=upload, filename="share", @@ -69,9 +53,6 @@ def test_search_upload(foss: Fossology, upload: Upload): assert search_result -@pytest.mark.skip( - reason="current Fossology version has a bug, /search is not supported, fixed in 4.3.0" -) def test_search_upload_does_not_exist(foss: Fossology): hash = {"sha1": "", "md5": "", "sha256": "", "size": ""} fake_upload = Upload( @@ -83,7 +64,7 @@ def test_search_upload_does_not_exist(foss: Fossology): "2020-12-30", hash=hash, ) - search_result = foss.search( + search_result, _ = foss.search( searchType=SearchTypes.ALLFILES, upload=fake_upload, filename="share", @@ -91,9 +72,6 @@ def test_search_upload_does_not_exist(foss: Fossology): assert not search_result -@pytest.mark.skip( - reason="current Fossology version has a bug, /search is not supported, fixed in 4.3.0" -) @responses.activate def test_search_error(foss_server: str, foss: Fossology): responses.add(responses.GET, f"{foss_server}/api/v1/search", status=404) diff --git a/tests/test_upload_licenses_copyrights.py b/tests/test_upload_licenses_copyrights.py index afdcc32..95d0a18 100644 --- a/tests/test_upload_licenses_copyrights.py +++ b/tests/test_upload_licenses_copyrights.py @@ -13,12 +13,12 @@ def test_upload_licenses(foss: Fossology, upload_with_jobs: Upload): # Default agent "nomos" licenses = foss.upload_licenses(upload_with_jobs) - assert len(licenses) == 56 + assert len(licenses) == 50 def test_upload_licenses_with_containers(foss: Fossology, upload_with_jobs: Upload): licenses = foss.upload_licenses(upload_with_jobs, containers=True) - assert len(licenses) == 56 + assert len(licenses) == 50 def test_upload_licenses_agent_ojo(foss: Fossology, upload_with_jobs: Upload): @@ -33,7 +33,7 @@ def test_upload_licenses_agent_monk(foss: Fossology, upload_with_jobs: Upload): def test_upload_licenses_and_copyrights(foss: Fossology, upload_with_jobs: Upload): licenses = foss.upload_licenses(upload_with_jobs, copyright=True) - assert len(licenses) == 56 + assert len(licenses) == 50 def test_upload_licenses_with_unknown_group_raises_authorization_error( diff --git a/tests/test_uploads.py b/tests/test_uploads.py index 0414458..3754935 100644 --- a/tests/test_uploads.py +++ b/tests/test_uploads.py @@ -87,7 +87,7 @@ def test_get_uploads( description="Test upload in subdirectory", wait_time=5, ) - assert len(foss.list_uploads()[0]) == 3 + assert len(foss.list_uploads()[0]) == 4 assert len(foss.list_uploads(folder=foss.rootFolder)[0]) == 3 assert len(foss.list_uploads(folder=foss.rootFolder, recursive=False)[0]) == 2 assert len(foss.list_uploads(folder=upload_subfolder)[0]) == 1