client = <django.test.client.Client object at 0x7f917e620e10>
archive_coverage_data = None
def test_coverage_view_with_metrics(client, archive_coverage_data):
# check view gets rendered without errors
url = reverse("swh-coverage")
resp = check_html_get_response(
client, url, status_code=200, template_used="misc/coverage.html"
)
# check logos and origins search links are present in the rendered page
for origins in chain(
listed_origins["origins"],
legacy_origins["origins"],
deposited_origins["origins"],
):
logo_url = f'{settings.STATIC_URL}img/logos/{origins["type"].lower()}.png'
assert_contains(resp, f'src="{logo_url}"')
origin_visit_types = set()
if "instances" in origins:
for visit_types_ in origins["instances"].values():
origin_visit_types.update(visit_types_.keys())
for data in visit_types_.values():
if data["count"]:
> assert_contains(resp, f'<a href="{escape(data["search_url"])}"')
.tox/py3/lib/python3.7/site-packages/swh/web/tests/misc/test_coverage.py:129:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/django/test/testcases.py:454: in assertContains
self.assertTrue(real_count != 0, msg_prefix + "Couldn't find %s in response" % text_repr)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <django.test.testcases.TestCase testMethod=run>, expr = False
msg = 'False is not true : Couldn\'t find \'<a href=""\' in response'
def assertTrue(self, expr, msg=None):
"""Check that the expression is true."""
if not expr:
msg = self._formatMessage(msg, "%s is not true" % safe_repr(expr))
> raise self.failureException(msg)
E AssertionError: False is not true : Couldn't find '<a href=""' in response
/usr/lib/python3.7/unittest/case.py:692: AssertionError
TEST RESULT
TEST RESULT
- Run At
- May 12 2022, 5:33 PM