Skip to content

Commit

Permalink
Fix the failing unit tests #3
Browse files Browse the repository at this point in the history
Signed-off-by: tdruez <[email protected]>
  • Loading branch information
tdruez committed Dec 20, 2023
1 parent 9edcf6b commit 14f3131
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<span class="me-2">
{% include 'includes/object_icon.html' with object=relation.package only %}
</span>
{% if relation.package.package_url in values.vulnerable_purls %}
{% if relation.package.package_url in vulnerable_purls %}
<a class="me-2" href="{{ relation.package.get_absolute_url }}#vulnerabilities" target="_blank" data-bs-toggle="tooltip" title="Vulnerabilities">
<i class="fas fa-bug vulnerability"></i>
</a>
Expand Down
9 changes: 7 additions & 2 deletions product_portfolio/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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 = '<i class="fas fa-bug vulnerability"></i></a>'
Expand Down

0 comments on commit 14f3131

Please sign in to comment.