From 14f3131593ffb2e07f8a30ae84452b9c83331c69 Mon Sep 17 00:00:00 2001 From: tdruez Date: Wed, 20 Dec 2023 10:54:15 -0600 Subject: [PATCH] Fix the failing unit tests #3 Signed-off-by: tdruez --- .../includes/productrelation_element.html | 2 +- product_portfolio/tests/test_views.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/product_portfolio/templates/product_portfolio/includes/productrelation_element.html b/product_portfolio/templates/product_portfolio/includes/productrelation_element.html index f5744aba..daaa64ed 100644 --- a/product_portfolio/templates/product_portfolio/includes/productrelation_element.html +++ b/product_portfolio/templates/product_portfolio/includes/productrelation_element.html @@ -3,7 +3,7 @@ {% include 'includes/object_icon.html' with object=relation.package only %} - {% if relation.package.package_url in values.vulnerable_purls %} + {% if relation.package.package_url in vulnerable_purls %} diff --git a/product_portfolio/tests/test_views.py b/product_portfolio/tests/test_views.py index d57d7996..aff0134c 100644 --- a/product_portfolio/tests/test_views.py +++ b/product_portfolio/tests/test_views.py @@ -386,13 +386,18 @@ def test_product_portfolio_detail_view_inventory_tab_compliance_alerts(self): owner=Owner.objects.create(name="Owner1", dataspace=self.dataspace), dataspace=self.dataspace, ) - ProductComponent.objects.create( + pc = ProductComponent.objects.create( product=self.product1, component=self.component1, license_expression=license1.key, dataspace=self.dataspace, ) + self.component1.usage_policy = component_policy + self.component1.save() + self.assertEqual("error", pc.inventory_item_compliance_alert) + + self.assertTrue(self.super_user.dataspace.show_usage_policy_in_user_views) url = self.product1.get_url("tab_inventory") response = self.client.get(url) self.assertContains(response, "Compliance errors") @@ -481,7 +486,7 @@ def test_product_detail_view_inventory_tab_display_vulnerabilities( mock_vulnerable_purls.return_value = [purl] self.client.login(username=self.super_user.username, password="secret") - url = self.product1.get_absolute_url() + url = self.product1.get_url("tab_inventory") response = self.client.get(url) expected = ''