From 1bb0b6b2f11c316c474c1e74bca773c050002ab9 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 6 Jan 2020 12:56:43 +0000 Subject: [PATCH] Fix incorrect assertion for letter job CSV link The statement `page.select('[download=download]')` was returning an empty list because the link on the page has an empty `download` attribute, rather than it being set to the string `download`. This commit: - updates the assertion to find the element on the page - makes the test more specific by checking where the link goes to, not just its exists or lack thereof --- tests/app/main/views/test_jobs.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/app/main/views/test_jobs.py b/tests/app/main/views/test_jobs.py index 2b3e8f707..0b386baae 100644 --- a/tests/app/main/views/test_jobs.py +++ b/tests/app/main/views/test_jobs.py @@ -329,7 +329,11 @@ def test_should_show_letter_job( assert normalize_spaces(page.select('.keyline-block')[1].text) == ( '6 January Estimated delivery date' ) - assert page.select('[download=download]') == [] + assert page.select_one('a[download]')['href'] == url_for( + 'main.view_job_csv', + service_id=SERVICE_ONE_ID, + job_id=fake_uuid, + ) assert page.select('.hint') == [] get_notifications.assert_called_with(