Commit Graph

2876 Commits

Author SHA1 Message Date
Rebecca Law
70276cb526 Added a new error message when the letter is mising an address block.
Before deploying a change to template-preview to return a validation error for letters that are missing the address block, we need to add the new erorr message to admin.

Some content changes have been made to other messages.
The format of the message has changed.
2020-01-10 14:42:56 +00:00
Katie Smith
0ec086cd24 Use fixtures for templates in a Pytest 5 compatible way 2020-01-09 09:48:16 +00:00
Katie Smith
9e3f21cd39 Stop calling mock_get_notications as if it's a function
By creating a new function in conftest.py, `create_notifications`, which
can be used instead.
2020-01-09 09:48:16 +00:00
Katie Smith
68983a21d2 Use fixtures for callbacks in a Pytest 5 compatible way 2020-01-09 09:48:16 +00:00
Katie Smith
a3978f8a5f Use fixtures that get services in Pytest 5 compatible way 2020-01-09 09:48:16 +00:00
Katie Smith
f93df53ed3 Stop calling more fixtures as functions
This commits stops calling more fixtures as if they were functions in
order to reduce the number of errors with Pytest 5.
2020-01-09 09:48:16 +00:00
Katie Smith
a602ce5937 Stop calling mock_get_no_api_keys and api_keys_mock like functions 2020-01-09 09:48:16 +00:00
Chris Hill-Scott
c270895c7f Merge pull request #3235 from alphagov/job-page-for-expired-jobs
Customise the job page for jobs whose notifications have been purged
2020-01-09 09:46:19 +00:00
Chris Hill-Scott
5bf29495ae Merge pull request #3242 from alphagov/fix-incorrect-assertion
Fix incorrect assertion for letter job CSV link
2020-01-08 09:57:26 +00:00
Leo Hemsted
91adadfed0 dont reassign os.environ
os.environ is an `environ` object, not a dict. by only interacting with
it through builtin functions we can ensure it remains properly
accessible to third party libraries which might interact with it in
different ways.

See https://github.com/alphagov/notifications-api/commit/d2441466 for
more detail
2020-01-07 12:03:30 +00:00
Chris Hill-Scott
1bb0b6b2f1 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
2020-01-06 12:56:43 +00:00
Tom Byers
6726ad31b9 Add test for SVG fallback image path
It's the only resource that uses the `asset_path`
template variable in `template.njk` so this checks
that works as expected.

From feedback on the associated pull request:

https://github.com/alphagov/notifications-admin/pull/3241#issuecomment-571102394
2020-01-06 11:40:12 +00:00
Chris Hill-Scott
93d2d47f4e Don’t show blue boxes once notifications have gone
You can click the blue boxes to filter the list of notifications. Once
the notifications have gone there’s nothing to filter, so we should just
show the numbers but without them being clickable.
2020-01-03 15:15:25 +00:00
Chris Hill-Scott
9446b35e3b Add a more accurate missing notifications message
Notifications could be missing because:
- none have been created yet
- they’ve been deleted

This commit adds separate error messages for each case, rather than a
less helpful generic one.
2020-01-03 15:14:37 +00:00
Chris Hill-Scott
d2f976c8ee Don’t show progress once notifications are gone
We work out how complete a job’s processing is by looking at how many
notifications have been created.

Later, we deleted all the notifications, according to the data retention
schedule. This makes it look like the job has gone back to 0% processed.

This commit accounts for this by not showing the % complete message once
a finished job has had its notifications deleted.
2020-01-03 15:12:45 +00:00
Chris Hill-Scott
e3b1813ed7 Add a test for the no notifications message
This wasn’t tested before.
2020-01-03 15:12:28 +00:00
Chris Hill-Scott
d11305741f Merge pull request #3237 from alphagov/returned-pdf-letters
Handle precompiled letters in returned letters list
2020-01-03 10:04:17 +00:00
Tom Byers
54a5f1d22c Merge pull request #3181 from alphagov/update-footer-links
Update footer links
2020-01-02 15:15:37 +00:00
Chris Hill-Scott
5ea02119f4 Handle precompiled via in returned letters list
Precompiled letters sent via the API don’t have:
- a template
- a filename

Which means in the list of returned letters we just show ‘None’. This
commit changes this to ‘Provided as PDF’, which is how we talk about
precompiled letters elsewhere (for example in the template statistics on
the dashboard).
2020-01-02 11:30:51 +00:00
Chris Hill-Scott
f0fe532b46 Pass uploaded file name into test data 2020-01-02 11:29:01 +00:00
Chris Hill-Scott
227fca6263 Make appearance of ‘empty’ table rows even
Our table rows take up 65px vertical space.

We also have things that look like rows that say:
- there are no rows
- there are more rows than can be shown on screen

This commit makes them appear the same height.
2019-12-31 14:40:17 +00:00
Chris Hill-Scott
3b7dc05dd6 Add a page for each report
It’s useful to get some kind of preview of the report before you
download it.

And if there’s only a few letters in there then you might not even need
to download it at all.

For teams with lots of letters we don’t want the page to load too slowly
so let’s cap the number of displayed items to 50, same as previewing
a spreadsheet.
2019-12-31 14:39:12 +00:00
Chris Hill-Scott
8bcfb2fcde Use file list pattern for list of files
This means the page has the same appearance as other lists of stuff like
the notifications page.
2019-12-31 14:37:19 +00:00
Tom Byers
59e40d4c3c Make dashboard test more specific
It was picking up the 'Get started' text from the
new link in the footer.
2019-12-31 10:29:56 +00:00
Rebecca Law
03fe7674bf Add a url_converter to check the date format. 2019-12-30 16:53:32 +00:00
Rebecca Law
41be4c054b Add test for url and pluralisation 2019-12-30 14:06:15 +00:00
Rebecca Law
401828d1e0 Remove POST where not needed.
Use  plural method to display letter or letters
Remove unused params from list_table method.
2019-12-30 08:39:39 +00:00
Rebecca Law
a4fed667e4 Updated to reflect change in API key in json result. 2019-12-27 12:40:12 +00:00
Rebecca Law
4c72efd08a Added tests 2019-12-24 14:33:52 +00:00
Rebecca Law
0273eea0cc Add email address and uploaded_letter 2019-12-24 11:22:12 +00:00
Tom Byers
869bd16536 Merge pull request #3225 from alphagov/fix-details
Add GOV.UK Frontend details component - second attempt
2019-12-23 09:47:56 +00:00
Katie Smith
3e83638193 Stop calling mock_get_notification fixture as a function
Instead of using `mock_get_notification` to create a notification then
mock it in the tests, a new function, `create_notification`, can be used
to create a custom notification to be mocked. Using this in the
`test_notifications.py` file makes it Pytest 5 compatible.
2019-12-20 15:48:25 +00:00
Katie Smith
6bc4f1898f Fix mock_get_organisation_by_domain and mock_get_service_organisation
This commits stops the `mock_get_organisation_by_domain` and
`mock_get_service_organisation` fixtures from being called like
functions.
2019-12-20 15:02:47 +00:00
Katie Smith
41d33b2995 Stop reply_to address fixtures from being called like functions
This stops most instances of the fixtures which return sms senders,
email reply to addresses or letter contact blocks from being called as
if they were functions in the tests by replacing them with functions
which return the same results.

This change allows a couple of fixtures which are now longer used to be
deleted.
2019-12-20 14:59:44 +00:00
Katie Smith
ccd245b287 Merge pull request #3229 from alphagov/pytest-5
Increase the number of tests that are Pytest 5 compliant
2019-12-20 10:55:13 +00:00
Katie Smith
e4134072d9 Reduce the errors related to user fixtures
We were using user fixtures in a lot of parameterized tests, but this is
no longer allowed in Pytest 5. To avoid having to split up the parametrized
tests (which would make the test files a lot longer and slightly more
difficult to read) this commit creates functions which return various types
of user json so that we can use these as the test parameters instead.
2019-12-19 16:59:07 +00:00
Katie Smith
b62018a8e4 Make a few more test files Pytest 5 compliant 2019-12-19 14:24:25 +00:00
Katie Smith
c6779e6f92 Stop the user fixtures being called as a functions from conftest
Stopped fixtures in conftest.py from calling the fixtures which return
user json as if they were functions. Deleted two fixtures that are now no
longer needed as a result of the changes to conftest.py.
2019-12-19 14:24:25 +00:00
Katie Smith
02253d32c5 Update user_json test function
Since we can't call the `api_user_active` fixture as a function with
Pytest 5, the `user_json` function can be used instead. This updates
the function to
- Stop returning `max_failed_login_count` since this is not a field that
gets returned from the api
- Return fields as strings, not UUIDS, to match the format that api
returns the data in
- Provide a way to use this function to return a user with no
permissions
2019-12-19 14:24:25 +00:00
Katie Smith
aec3ccff3a Fix navigation tests to not call app_() directly 2019-12-19 14:24:25 +00:00
Chris Hill-Scott
eb87548632 Serve video from a domain that doesn’t set cookies
Then it’s one less cookie we have to get users to opt in to. We don’t
derive any value from Youtube setting cookies.

`youtube-nocookie.com` is a domain provided by Google for this purpose.
2019-12-19 13:43:44 +00:00
Tom Byers
146d5cc07a Fix test broken by HTML changes on API page
I moved the meta for each message into the
`<h3>` in each `<summary>` to make the heading
unique. This broke the test.
2019-12-17 10:27:10 +00:00
Chris Hill-Scott
4da9c44919 Tell users that they can search by reference
Users who have an API integration (and therefore have a way of passing
in a reference for each notification) can now search by that reference
(see https://github.com/alphagov/notifications-api/pull/2682)

This commit changes the label on the search box to tell these users that
this is possible, without changing the label for users without an API
integration, who might get confused by what ‘reference’ means.

It also makes the label consistently say ‘email address or phone number’
(ie email address is first) because this is our content style.
2019-12-17 10:19:19 +00:00
Tom Byers
de6281bc0e Revert "Add GOVUK Frontend details component" 2019-12-16 16:20:03 +00:00
Tom Byers
60fe9d3400 Merge pull request #3209 from alphagov/add-govuk-frontend-details
Add GOVUK Frontend details component
2019-12-16 15:22:15 +00:00
Chris Hill-Scott
581296b95e Fix off-by-one dates on provider history
We chunk history entries by their YYYY-MM-DD date representation to
display them day-by-day.

However trying to convert a YYYY-MM-DD string into a timestamp is
unpredictable, and was causing our dates to be one day out (probably
because of midnight/daylight savings/general datetime horrors).

This commit changes the code to do the same thing as the history page,
which is look at the `updated_at` field on the first entry to get a
datetime object and from that the formatted date we show in the headings
on the page.
2019-12-13 13:20:56 +00:00
Chris Hill-Scott
1bd27b97f6 Remove change link from international SMS provider
We don’t want to set it independently from the other SMS providers.
2019-12-12 14:34:04 +00:00
Chris Hill-Scott
57a602c2ab Add temporary link to change priority page
Lets you get to the new page without having to think about the design
of the existing index page.
2019-12-11 10:17:48 +00:00
Chris Hill-Scott
8122fa1d5d Simplify and add tests
Makes these assumptions:
- we don’t care about history before 29th November 2019 at 11am (this
  is when priority started to mean a proportion rather than a ranking)
- the priority of the second provider will always be the inverse of
  the first provider

Which means the code is a lot simpler/actually does what you’d expect.
2019-12-11 10:17:46 +00:00
Tom Byers
d0a492988d Remove mistakenly added .swp file 2019-12-09 16:24:48 +00:00