From 59e9e0e4ec1e1005321cc35157d02ae069eb50bf Mon Sep 17 00:00:00 2001 From: Jono Yang Date: Tue, 13 Aug 2024 15:11:24 -0700 Subject: [PATCH] Update expected test results #512 #515 Signed-off-by: Jono Yang --- packagedb/tests/test_api.py | 14 +- .../testfiles/api/twill-core-0.12.0.json | 554 ++++++++++++------ 2 files changed, 376 insertions(+), 192 deletions(-) diff --git a/packagedb/tests/test_api.py b/packagedb/tests/test_api.py index 46d93162..35e5ca63 100644 --- a/packagedb/tests/test_api.py +++ b/packagedb/tests/test_api.py @@ -977,18 +977,16 @@ def test_package_live(self): 1, Package.objects.filter(download_url=sources_download_url).count() ) expected = self.get_test_loc("api/twill-core-0.12.0.json") - - self.assertEqual(2, len(response.data)) - # Sort results by name - results = sorted(response.data, key=lambda x: x["name"]) - result = results[0] + results = response.data + self.assertEqual(2, len(results)) # remove fields - result.pop("url") - fields_to_remove = ["uuid", "resources", "package_sets", "history"] + for result in results: + result.pop("url") + fields_to_remove = ["uuid", "resources", "package_sets", "history"] self.check_expected_results( - result, expected, fields_to_remove=fields_to_remove, regen=FIXTURES_REGEN + results, expected, fields_to_remove=fields_to_remove, regen=FIXTURES_REGEN ) # Ensure that the created ScannableURI objects have a priority of 100 diff --git a/packagedb/tests/testfiles/api/twill-core-0.12.0.json b/packagedb/tests/testfiles/api/twill-core-0.12.0.json index 0c1c60fa..114217e8 100644 --- a/packagedb/tests/testfiles/api/twill-core-0.12.0.json +++ b/packagedb/tests/testfiles/api/twill-core-0.12.0.json @@ -1,184 +1,370 @@ -{ - "filename":"twill-core-0.12.0.jar", - "package_content":"binary", - "purl":"pkg:maven/org.apache.twill/twill-core@0.12.0", - "type":"maven", - "namespace":"org.apache.twill", - "name":"twill-core", - "version":"0.12.0", - "qualifiers":"", - "subpath":"", - "primary_language":"Java", - "description":"Apache Twill core library", - "release_date":null, - "parties":[ - { - "type":"organization", - "role":"owner", - "name":"The Apache Software Foundation", - "email":null, - "url":"http://www.apache.org/" - } - ], - "keywords":[], - "homepage_url":"http://www.apache.org/", - "download_url":"https://repo1.maven.org/maven2/org/apache/twill/twill-core/0.12.0/twill-core-0.12.0.jar", - "bug_tracking_url":null, - "code_view_url":null, - "vcs_url":null, - "repository_homepage_url":null, - "repository_download_url":null, - "api_data_url":null, - "size":null, - "md5":null, - "sha1":"252cc5e60690d611a9981d1b3fabeb0d3a7e8a28", - "sha256":null, - "sha512":null, - "copyright":null, - "holder":null, - "declared_license_expression":"apache-2.0", - "declared_license_expression_spdx":"Apache-2.0", - "license_detections":[], - "other_license_expression":null, - "other_license_expression_spdx":null, - "other_license_detections":[], - "extracted_license_statement":null, - "notice_text":null, - "source_packages":[ - "pkg:maven/org.apache.twill/twill-core@0.12.0?classifier=sources" - ], - "extra_data":{}, - "package_uid":"pkg:maven/org.apache.twill/twill-core@0.12.0?uuid=fixed-uid-done-for-testing-5642512d1758", - "datasource_id":null, - "file_references":[], - "dependencies":[ - { - "purl":"pkg:maven/org.apache.twill/twill-api@0.12.0", - "extracted_requirement":"0.12.0", - "scope":"compile", - "is_runtime":false, - "is_optional":true, - "is_resolved":true - }, - { - "purl":"pkg:maven/org.apache.twill/twill-zookeeper@0.12.0", - "extracted_requirement":"0.12.0", - "scope":"compile", - "is_runtime":false, - "is_optional":true, - "is_resolved":true - }, - { - "purl":"pkg:maven/org.apache.twill/twill-discovery-core@0.12.0", - "extracted_requirement":"0.12.0", - "scope":"compile", - "is_runtime":false, - "is_optional":true, - "is_resolved":true - }, - { - "purl":"pkg:maven/com.google.guava/guava", - "extracted_requirement":null, - "scope":"compile", - "is_runtime":false, - "is_optional":true, - "is_resolved":false - }, - { - "purl":"pkg:maven/com.google.code.gson/gson", - "extracted_requirement":null, - "scope":"compile", - "is_runtime":false, - "is_optional":true, - "is_resolved":false - }, - { - "purl":"pkg:maven/io.netty/netty", - "extracted_requirement":null, - "scope":"compile", - "is_runtime":false, - "is_optional":true, - "is_resolved":false - }, - { - "purl":"pkg:maven/org.xerial.snappy/snappy-java", - "extracted_requirement":null, - "scope":"compile", - "is_runtime":false, - "is_optional":true, - "is_resolved":false - }, - { - "purl":"pkg:maven/org.ow2.asm/asm-all", - "extracted_requirement":null, - "scope":"compile", - "is_runtime":false, - "is_optional":true, - "is_resolved":false - }, - { - "purl":"pkg:maven/org.slf4j/slf4j-api", - "extracted_requirement":null, - "scope":"compile", - "is_runtime":false, - "is_optional":true, - "is_resolved":false - }, - { - "purl":"pkg:maven/ch.qos.logback/logback-core", - "extracted_requirement":null, - "scope":"compile", - "is_runtime":false, - "is_optional":true, - "is_resolved":false - }, - { - "purl":"pkg:maven/ch.qos.logback/logback-classic", - "extracted_requirement":null, - "scope":"compile", - "is_runtime":false, - "is_optional":true, - "is_resolved":false - }, - { - "purl":"pkg:maven/org.apache.kafka/kafka_2.10", - "extracted_requirement":null, - "scope":"compile", - "is_runtime":false, - "is_optional":true, - "is_resolved":false - }, - { - "purl":"pkg:maven/net.sf.jopt-simple/jopt-simple", - "extracted_requirement":null, - "scope":"compile", - "is_runtime":false, - "is_optional":true, - "is_resolved":false - }, - { - "purl":"pkg:maven/junit/junit", - "extracted_requirement":null, - "scope":"compile", - "is_runtime":false, - "is_optional":true, - "is_resolved":false - }, - { - "purl":"pkg:maven/org.unitils/unitils-core", - "extracted_requirement":null, - "scope":"compile", - "is_runtime":false, - "is_optional":true, - "is_resolved":false - }, - { - "purl":"pkg:maven/org.apache.commons/commons-compress", - "extracted_requirement":null, - "scope":"compile", - "is_runtime":false, - "is_optional":true, - "is_resolved":false - } - ] -} \ No newline at end of file +[ + { + "filename":"twill-core-0.12.0.jar", + "package_content":"binary", + "purl":"pkg:maven/org.apache.twill/twill-core@0.12.0", + "type":"maven", + "namespace":"org.apache.twill", + "name":"twill-core", + "version":"0.12.0", + "qualifiers":"", + "subpath":"", + "primary_language":"Java", + "description":"Apache Twill core library", + "release_date":null, + "parties":[ + { + "type":"organization", + "role":"owner", + "name":"The Apache Software Foundation", + "email":null, + "url":"http://www.apache.org/" + } + ], + "keywords":[], + "homepage_url":"http://www.apache.org/", + "download_url":"https://repo1.maven.org/maven2/org/apache/twill/twill-core/0.12.0/twill-core-0.12.0.jar", + "bug_tracking_url":null, + "code_view_url":null, + "vcs_url":null, + "repository_homepage_url":null, + "repository_download_url":null, + "api_data_url":null, + "size":null, + "md5":null, + "sha1":"252cc5e60690d611a9981d1b3fabeb0d3a7e8a28", + "sha256":null, + "sha512":null, + "copyright":null, + "holder":null, + "declared_license_expression":"apache-2.0", + "declared_license_expression_spdx":"Apache-2.0", + "license_detections":[], + "other_license_expression":null, + "other_license_expression_spdx":null, + "other_license_detections":[], + "extracted_license_statement":null, + "notice_text":null, + "source_packages":[ + "pkg:maven/org.apache.twill/twill-core@0.12.0?classifier=sources" + ], + "extra_data":{}, + "package_uid":"pkg:maven/org.apache.twill/twill-core@0.12.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datasource_id":null, + "file_references":[], + "dependencies":[ + { + "purl":"pkg:maven/org.apache.twill/twill-api@0.12.0", + "extracted_requirement":"0.12.0", + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":true + }, + { + "purl":"pkg:maven/org.apache.twill/twill-zookeeper@0.12.0", + "extracted_requirement":"0.12.0", + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":true + }, + { + "purl":"pkg:maven/org.apache.twill/twill-discovery-core@0.12.0", + "extracted_requirement":"0.12.0", + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":true + }, + { + "purl":"pkg:maven/com.google.guava/guava", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + }, + { + "purl":"pkg:maven/com.google.code.gson/gson", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + }, + { + "purl":"pkg:maven/io.netty/netty", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + }, + { + "purl":"pkg:maven/org.xerial.snappy/snappy-java", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + }, + { + "purl":"pkg:maven/org.ow2.asm/asm-all", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + }, + { + "purl":"pkg:maven/org.slf4j/slf4j-api", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + }, + { + "purl":"pkg:maven/ch.qos.logback/logback-core", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + }, + { + "purl":"pkg:maven/ch.qos.logback/logback-classic", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + }, + { + "purl":"pkg:maven/org.apache.kafka/kafka_2.10", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + }, + { + "purl":"pkg:maven/net.sf.jopt-simple/jopt-simple", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + }, + { + "purl":"pkg:maven/junit/junit", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + }, + { + "purl":"pkg:maven/org.unitils/unitils-core", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + }, + { + "purl":"pkg:maven/org.apache.commons/commons-compress", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + } + ] + }, + { + "filename":"twill-core-0.12.0-sources.jar", + "package_content":"source_archive", + "purl":"pkg:maven/org.apache.twill/twill-core@0.12.0?classifier=sources", + "type":"maven", + "namespace":"org.apache.twill", + "name":"twill-core", + "version":"0.12.0", + "qualifiers":"classifier=sources", + "subpath":"", + "primary_language":"Java", + "description":"Apache Twill core library", + "release_date":null, + "parties":[ + { + "type":"organization", + "role":"owner", + "name":"The Apache Software Foundation", + "email":null, + "url":"http://www.apache.org/" + } + ], + "keywords":[], + "homepage_url":"http://www.apache.org/", + "download_url":"https://repo1.maven.org/maven2/org/apache/twill/twill-core/0.12.0/twill-core-0.12.0-sources.jar", + "bug_tracking_url":null, + "code_view_url":null, + "vcs_url":null, + "repository_homepage_url":null, + "repository_download_url":null, + "api_data_url":null, + "size":null, + "md5":null, + "sha1":"dfbe61539b44213f389ff7d9a7745173d114b6df", + "sha256":null, + "sha512":null, + "copyright":null, + "holder":null, + "declared_license_expression":"apache-2.0", + "declared_license_expression_spdx":"Apache-2.0", + "license_detections":[], + "other_license_expression":null, + "other_license_expression_spdx":null, + "other_license_detections":[], + "extracted_license_statement":null, + "notice_text":null, + "source_packages":[ + "pkg:maven/org.apache.twill/twill-core@0.12.0?classifier=sources" + ], + "extra_data":{}, + "package_uid":"pkg:maven/org.apache.twill/twill-core@0.12.0?classifier=sources&uuid=fixed-uid-done-for-testing-5642512d1758", + "datasource_id":null, + "file_references":[], + "dependencies":[ + { + "purl":"pkg:maven/org.apache.twill/twill-api@0.12.0", + "extracted_requirement":"0.12.0", + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":true + }, + { + "purl":"pkg:maven/org.apache.twill/twill-zookeeper@0.12.0", + "extracted_requirement":"0.12.0", + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":true + }, + { + "purl":"pkg:maven/org.apache.twill/twill-discovery-core@0.12.0", + "extracted_requirement":"0.12.0", + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":true + }, + { + "purl":"pkg:maven/com.google.guava/guava", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + }, + { + "purl":"pkg:maven/com.google.code.gson/gson", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + }, + { + "purl":"pkg:maven/io.netty/netty", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + }, + { + "purl":"pkg:maven/org.xerial.snappy/snappy-java", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + }, + { + "purl":"pkg:maven/org.ow2.asm/asm-all", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + }, + { + "purl":"pkg:maven/org.slf4j/slf4j-api", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + }, + { + "purl":"pkg:maven/ch.qos.logback/logback-core", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + }, + { + "purl":"pkg:maven/ch.qos.logback/logback-classic", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + }, + { + "purl":"pkg:maven/org.apache.kafka/kafka_2.10", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + }, + { + "purl":"pkg:maven/net.sf.jopt-simple/jopt-simple", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + }, + { + "purl":"pkg:maven/junit/junit", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + }, + { + "purl":"pkg:maven/org.unitils/unitils-core", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + }, + { + "purl":"pkg:maven/org.apache.commons/commons-compress", + "extracted_requirement":null, + "scope":"compile", + "is_runtime":false, + "is_optional":true, + "is_resolved":false + } + ] + } +] \ No newline at end of file