Skip to content

Commit 03c42f2

Browse files
committed
Fix unit tests
Signed-off-by: tdruez <tdruez@aboutcode.org>
1 parent 14f94c5 commit 03c42f2

3 files changed

Lines changed: 17 additions & 42 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<strong class="ms-1">{{ scan.status_for_display }}</strong>
22
{% include 'component_catalog/includes/scan_status.html' with status=scan.status only %}
3-
<div class="text-center mt-2">
3+
<div class="text-center mt-2" style="min-width:190px;">
44
{% include 'component_catalog/includes/scan_actions_list.html' with scan=scan only %}
55
</div>

component_catalog/templates/component_catalog/includes/scan_status.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="progress" style="width: 100%; min-width:190px ;margin-bottom: 0; height: .5rem;">
1+
<div class="progress mb-0 w-100" style="height: .5rem;">
22
{% if status == 'success' %}
33
<div class="progress-bar {% if has_errors %}bg-warning{% else %}bg-success{% endif %}" title="{{ status|title }}" role="progressbar" style="width: 100%" aria-label="Scan progress" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
44
{% elif status == 'failure' or status == "stopped" or status == "stale" %}

component_catalog/tests/test_views.py

Lines changed: 15 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2100,46 +2100,21 @@ def test_package_details_view_scan_tab_scan_in_progress(
21002100
self.dataspace.save()
21012101
response = self.client.get(self.package1_tab_scan_url)
21022102

2103-
expected = """
2104-
<dl class="row mb-0">
2105-
<dt class="col-sm-2 text-end pt-2 pe-0">Status</dt>
2106-
<dd class="col-sm-10 clipboard">
2107-
<button class="btn-clipboard" data-bs-toggle="tooltip" title="Copy to clipboard">
2108-
<i class="fas fa-clipboard"></i></button>
2109-
<pre class="pre-bg-body-tertiary mb-1 field-status">Scan running</pre>
2110-
</dd>
2111-
<dt class="col-sm-2 text-end pt-2 pe-0">Created date</dt>
2112-
<dd class="col-sm-10 clipboard">
2113-
<button class="btn-clipboard" data-bs-toggle="tooltip" title="Copy to clipboard">
2114-
<i class="fas fa-clipboard"></i></button>
2115-
<pre class="pre-bg-body-tertiary mb-1 field-created-date">
2116-
Jun 21, 2018, 12:32 PM UTC
2117-
</pre>
2118-
</dd>
2119-
<dt class="col-sm-2 text-end pt-2 pe-0">Start date</dt>
2120-
<dd class="col-sm-10 clipboard">
2121-
<button class="btn-clipboard" data-bs-toggle="tooltip" title="Copy to clipboard">
2122-
<i class="fas fa-clipboard"></i></button>
2123-
<pre class="pre-bg-body-tertiary mb-1 field-start-date">
2124-
Jun 21, 2018, 12:32 PM UTC
2125-
</pre>
2126-
</dd>
2127-
<dt class="col-sm-2 text-end pt-2 pe-0">End date</dt>
2128-
<dd class="col-sm-10 clipboard">
2129-
<pre class="pre-bg-body-tertiary mb-1 field-end-date">&nbsp;</pre>
2130-
</dd>
2131-
<dt class="col-sm-2 text-end pt-2 pe-0">ScanCode.io version</dt>
2132-
<dd class="col-sm-10 clipboard">
2133-
<button class="btn-clipboard" data-bs-toggle="tooltip" title="Copy to clipboard">
2134-
<i class="fas fa-clipboard"></i></button>
2135-
<pre class="pre-bg-body-tertiary mb-1 field-scancodeio-version">31.0.0</pre>
2136-
</dd>
2137-
<dt class="col-sm-2 text-end pt-2 pe-0"></dt>
2138-
<dd class="col-sm-10">
2139-
<ul class="list-inline mb-0"></ul>
2140-
</dd>
2141-
</dl>
2142-
"""
2103+
expected = '<pre class="pre-bg-body-tertiary mb-1 field-status">Scan running</pre>'
2104+
self.assertContains(response, expected, html=True)
2105+
expected = (
2106+
'<pre class="pre-bg-body-tertiary mb-1 field-created-date">'
2107+
" Jun 21, 2018, 12:32 PM UTC"
2108+
"</pre>"
2109+
)
2110+
self.assertContains(response, expected, html=True)
2111+
expected = (
2112+
'<pre class="pre-bg-body-tertiary mb-1 field-start-date">'
2113+
" Jun 21, 2018, 12:32 PM UTC"
2114+
"</pre>"
2115+
)
2116+
self.assertContains(response, expected, html=True)
2117+
expected = '<pre class="pre-bg-body-tertiary mb-1 field-scancodeio-version">31.0.0</pre>'
21432118
self.assertContains(response, expected, html=True)
21442119
self.assertNotContains(response, "Set values to Package")
21452120

0 commit comments

Comments
 (0)