Skip to content

Commit

Permalink
Fix tests #25
Browse files Browse the repository at this point in the history
Signed-off-by: tdruez <[email protected]>
  • Loading branch information
tdruez committed Feb 13, 2024
1 parent 5835d34 commit 6559254
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 17 deletions.
14 changes: 10 additions & 4 deletions component_catalog/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,10 +614,12 @@ def test_component_catalog_detail_view_owner_tab_hierarchy_availability(self):
self.assertContains(response, child_owner.name)

self.assertContains(
response, '<div id="owner_{}" class="card bg-body-tertiary mb-2">'.format(self.owner1.id)
response,
'<div id="owner_{}" class="card bg-body-tertiary mb-2">'.format(self.owner1.id),
)
self.assertContains(
response, '<div id="owner_{}" class="card bg-body-tertiary mb-2">'.format(child_owner.id)
response,
'<div id="owner_{}" class="card bg-body-tertiary mb-2">'.format(child_owner.id),
)
self.assertContains(
response, f"{{source: 'owner_{child_owner.id}', target: 'owner_{self.owner1.id}'}}"
Expand Down Expand Up @@ -1025,7 +1027,9 @@ def test_component_catalog_details_view_acceptable_linkages_in_policy_tab(self):

response = self.client.get(details_url)
expected = (
'<pre class="pre-bg-body-tertiary mb-1 field-acceptable-linkages">linkage1 linkage2</pre>'
'<pre class="pre-bg-body-tertiary mb-1 field-acceptable-linkages">'
" linkage1 linkage2"
"</pre>"
)
self.assertContains(response, expected, html=True)

Expand Down Expand Up @@ -2041,7 +2045,9 @@ def test_package_details_view_scan_tab_scan_in_progress(
<dd class="col-sm-10 clipboard">
<button class="btn-clipboard" data-bs-toggle="tooltip" title="Copy to clipboard">
<i class="fas fa-clipboard"></i></button>
<pre class="pre-bg-body-tertiary mb-1 field-created-date">June 21, 2018, 12:32 PM UTC</pre>
<pre class="pre-bg-body-tertiary mb-1 field-created-date">
June 21, 2018, 12:32 PM UTC
</pre>
</dd>
<dt class="col-sm-2 text-end pt-2 pe-0">Start date</dt>
<dd class="col-sm-10 clipboard">
Expand Down
6 changes: 4 additions & 2 deletions license_library/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,10 +604,12 @@ def test_license_library_detail_view_owner_tab_hierarchy_availability(self):
self.assertContains(response, child_owner.name)

self.assertContains(
response, '<div id="owner_{}" class="card bg-body-tertiary mb-2">'.format(self.owner1.id)
response,
'<div id="owner_{}" class="card bg-body-tertiary mb-2">'.format(self.owner1.id),
)
self.assertContains(
response, '<div id="owner_{}" class="card bg-body-tertiary mb-2">'.format(child_owner.id)
response,
'<div id="owner_{}" class="card bg-body-tertiary mb-2">'.format(child_owner.id),
)
self.assertContains(
response, f"{{source: 'owner_{child_owner.id}', target: 'owner_{self.owner1.id}'}}"
Expand Down
4 changes: 3 additions & 1 deletion organization/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ def test_owner_details_view_unicode_utf8_name_support(self):
self.owner1.name = "Gómez"
self.owner1.save()
response = self.client.get(self.owner1.get_absolute_url())
self.assertContains(response, '<pre class="pre-bg-body-tertiary mb-1 field-name">Gómez</pre>')
self.assertContains(
response, '<pre class="pre-bg-body-tertiary mb-1 field-name">Gómez</pre>'
)
self.assertContains(response, "<strong>Gómez</strong>")
expected_urn = '<a href="/urn/urn:dje:owner:G%25C3%25B3mez/">urn:dje:owner:G%C3%B3mez</a>'
self.assertContains(response, expected_urn)
Expand Down
2 changes: 1 addition & 1 deletion product_portfolio/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ def test_product_portfolio_product_tree_comparison_view_proper(self):
right_uuid=self.product2.uuid,
)
response = self.client.get(url)
expected = f'{self.product1} <i class="fas fa-exchange-alt"></i> {self.product2}'
expected = f'{self.product1} <i class="fas fa-exchange-alt mx-2"></i> {self.product2}'
self.assertContains(response, expected)

purpose = ProductItemPurpose.objects.create(
Expand Down
19 changes: 10 additions & 9 deletions workflow/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,7 @@ def test_workflow_request_add_view_get_form(self):
'class="textarea form-control" required id="id_field_1">',
html=True,
)
expected = (
'<select name="priority" class="form-control-sm select form-select" id="id_priority">'
)
expected = '<select name="priority" class="select form-select" id="id_priority">'
self.assertContains(response, expected)
expected = f'<option value="{self.priority1.id}">{self.priority1.label}</option>'
self.assertContains(response, expected, html=True)
Expand Down Expand Up @@ -483,8 +481,7 @@ def test_workflow_request_add_view_product_context_dataspace_scope(self):

response = self.client.get(url)
expected_html = (
'<select name="product_context" class="form-control-sm select form-select" '
'id="id_product_context">'
'<select name="product_context" class="select form-select" ' 'id="id_product_context">'
)
self.assertContains(response, expected_html)

Expand Down Expand Up @@ -942,7 +939,7 @@ def test_workflow_request_add_view_with_content_object(self):
<input type="text" name="applies_to" value="{self.component1}"
placeholder="Start typing for suggestions..."
data-api_url="/api/v2/components/"
class="form-control-sm autocompleteinput form-control"
class="autocompleteinput form-control"
id="id_applies_to"
>
"""
Expand Down Expand Up @@ -1026,7 +1023,9 @@ def test_workflow_request_add_view_boolean_field_to_serialized_data(self):
self.assertIsNone(request_instance.last_modified_by)

response = self.client.get(request_instance.get_absolute_url())
self.assertContains(response, '<pre id="Bool" class="pre-bg-body-tertiary">Yes</pre>', html=True)
self.assertContains(
response, '<pre id="Bool" class="pre-bg-body-tertiary">Yes</pre>', html=True
)
url = reverse("workflow:request_edit", args=[request_instance.uuid])
response = self.client.get(url)
expected = '<option value="1" selected="selected">Yes</option>'
Expand All @@ -1044,7 +1043,9 @@ def test_workflow_request_add_view_boolean_field_to_serialized_data(self):
self.assertEqual(self.basic_user, request_instance.last_modified_by)

response = self.client.get(request_instance.get_absolute_url())
self.assertContains(response, '<pre id="Bool" class="pre-bg-body-tertiary">No</pre>', html=True)
self.assertContains(
response, '<pre id="Bool" class="pre-bg-body-tertiary">No</pre>', html=True
)

url = reverse("workflow:request_edit", args=[request_instance.uuid])
response = self.client.get(url)
Expand Down Expand Up @@ -1163,7 +1164,7 @@ def test_workflow_request_edit_view_content_object(self):
<input type="text" name="applies_to" value="{component2}"
placeholder="Start typing for suggestions..."
data-api_url="/api/v2/components/"
class="form-control-sm autocompleteinput form-control"
class="autocompleteinput form-control"
id="id_applies_to" />
"""
self.assertContains(response, expected, html=True)
Expand Down

0 comments on commit 6559254

Please sign in to comment.