Skip to content

Commit 0788e66

Browse files
committed
Fix tests
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
1 parent 0a43c28 commit 0788e66

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

vulnerabilities/tests/test_data/package_sort/sorted_purls.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ pkg:conan/capnproto@0.15.2
2121
pkg:deb/debian/jackson-databind@2.8.6-1%2Bdeb9u7?distro=stretch
2222
pkg:deb/debian/jackson-databind@2.8.6-1%2Bdeb9u10?distro=stretch
2323
pkg:deb/debian/jackson-databind@2.9.8-3%2Bdeb10u4?distro=sid
24-
pkg:deb/debian/jackson-databind@2.12.1-1%2Bdeb11u1
2524
pkg:deb/debian/jackson-databind@2.12.1-1%2Bdeb11u1?distro=sid
26-
pkg:deb/debian/jackson-databind@2.13.2.2-1?distro=sid
25+
pkg:deb/debian/jackson-databind@2.12.1-1%2Bdeb11u1
2726
pkg:deb/debian/jackson-databind@2.13.2.2-1?distro=stretch
27+
pkg:deb/debian/jackson-databind@2.13.2.2-1?distro=sid
2828
pkg:deb/debian/jackson-databind@2.14.0-1?distro=sid
2929
pkg:deb/ubuntu/dpkg@1.13.11ubuntu7~proposed
3030
pkg:deb/ubuntu/dpkg@1.13.11ubuntu7.2
@@ -94,10 +94,10 @@ pkg:pypi/jinja2@2.1.1
9494
pkg:pypi/jinja2@2.2
9595
pkg:pypi/jinja2@2.2.1
9696
pkg:pypi/jinja2@2.10
97-
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=11
98-
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=12
99-
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=13
100-
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=2
101-
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=5
102-
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=7
10397
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=9
98+
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=7
99+
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=5
100+
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=2
101+
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=13
102+
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=12
103+
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=11

vulnerabilities/tests/test_view.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@
2323
from vulnerabilities.models import Vulnerability
2424
from vulnerabilities.models import VulnerabilitySeverity
2525
from vulnerabilities.templatetags.url_filters import url_quote_filter
26+
from vulnerabilities.utils import get_purl_version_class
2627
from vulnerabilities.views import PackageDetails
2728
from vulnerabilities.views import PackageSearch
28-
from vulnerabilities.views import get_purl_version_class
29-
from vulnerabilities.views import purl_sort_key
3029

3130
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
3231
TEST_DIR = os.path.join(BASE_DIR, "test_data/package_sort")
@@ -202,12 +201,13 @@ def setUp(self):
202201
for pkg in input_purls:
203202
real_purl = PackageURL.from_string(pkg)
204203
attrs = {k: v for k, v in real_purl.to_dict().items() if v}
205-
Package.objects.create(**attrs)
204+
pkg = Package.objects.create(**attrs)
205+
pkg.calculate_version_rank
206206

207207
def test_sorted_queryset(self):
208208
qs_all = Package.objects.all()
209209
pkgs_qs_all = list(qs_all)
210-
sorted_pkgs_qs_all = sorted(pkgs_qs_all, key=purl_sort_key)
210+
sorted_pkgs_qs_all = pkgs_qs_all
211211

212212
pkg_package_urls = [obj.package_url for obj in sorted_pkgs_qs_all]
213213
sorted_purls = os.path.join(TEST_DIR, "sorted_purls.txt")

0 commit comments

Comments
 (0)