Commit Graph

2730 Commits

Author SHA1 Message Date
Tom Byers
28140104f1 Fix python tests broken by cookie banner 2020-01-20 10:03:19 +00:00
Chris Hill-Scott
c4818eb7f2 Rename property on ModelLists
The property doesn’t represent the whole client, but just one method on
it. So this commit renames the property to better describe what it is
designed to store.
2020-01-16 16:31:20 +00:00
Chris Hill-Scott
721134dc17 Merge pull request #3251 from alphagov/job-model
Make models for individual jobs and collections of jobs
2020-01-16 15:52:21 +00:00
Leo Hemsted
66db735e09 Revert "Merge pull request #3238 from alphagov/cookies-update"
This reverts commit eec4bec761, reversing
changes made to 64480e2fff.
2020-01-15 14:40:48 +00:00
Tom Byers
eec4bec761 Merge pull request #3238 from alphagov/cookies-update
New cookies banner and page
2020-01-15 10:37:14 +00:00
Chris Hill-Scott
0b6744854b Fix test that fails 1 in 60 times
This test looks for how many times the string `50` appears in the text
of the `<main>` element of the page. The `<main>` element also contains
some times, for example 1:23pm.

This means that when the time reaches 1:50pm, 2:50pm, etc the number of
times the string `50` appears in the page changes. Which causes the test
assertions to fail.
2020-01-14 14:06:04 +00:00
Chris Hill-Scott
4552587829 Merge pull request #3256 from alphagov/fix-session-bug-change-user-email
Fix session bug when changing user’s email address
2020-01-14 13:46:03 +00:00
Tom Byers
4a303cf0d8 Merge branch 'master' into cookies-update 2020-01-14 13:17:21 +00:00
Chris Hill-Scott
e9ad2e9c42 Only put the overlay on bad pages
This will make it easier to find errors in your file, because you won’t
spent time looking for them on pages which are OK.
2020-01-13 17:42:44 +00:00
Chris Hill-Scott
7d52ac97f1 Move stats to the model
The API clients should just deal with calling the API and returning the
data from it.

Inferring things from the data is more logically done at the model
layer. But we couldn’t do that before, because we didn’t have a model
layer for jobs.
2020-01-13 15:10:16 +00:00
Chris Hill-Scott
25464a141b Use a ModelList for lists of jobs
This follows the pattern of what we’ve done with services, users and
events.

It gives us a way of neatly instantiating a model for each item in the
list we get back from the API and reduces the complexity of the view
layer code.

Now is a good time to do this because we’re going to be making a bunch
of changes to the jobs pages, and those changes will be easier to code
and understand with a sensible model behind them.
2020-01-13 15:10:10 +00:00
Rebecca Law
e7928512e8 Merge pull request #3240 from alphagov/recipient-address
Show the first line of the address from the to field.
2020-01-13 14:29:33 +00:00
Chris Hill-Scott
5e7ec3e30d Make a job model for individual jobs
This follows the pattern of what we’ve done with services, users and
events.

It gives us a better interface to the data we get back from the API than
dealing with the raw JSON directly.

Now is a good time to do this because we’re going to be making a bunch
of changes to the jobs pages, and those changes will be easier to code
and understand with a sesnsible model behind them.
2020-01-13 13:05:35 +00:00
Chris Hill-Scott
72eb6ef99a Fix session bug when changing user’s email address
The session key we use is global.

This means if you open the edit page for two different users in two
different tabs the session for the first tab is overwritten with the
session from the second tab. This means the two users are both set to
the same email address, which causes an exception (email addresses are
unique).

This commit fixes that bug by including the user ID in the session ID.
2020-01-13 12:03:39 +00:00
Chris Hill-Scott
c391729dc0 Merge pull request #3247 from alphagov/buttony
Make create account button more buttony
2020-01-13 10:35:34 +00:00
Rebecca Law
40575bbb75 Rebase pytest 5 changes
Add to field in creation of notification
2020-01-10 16:06:04 +00:00
Rebecca Law
9d1f92a752 Strip the trailing comma on the first line of an address block. 2020-01-10 16:06:04 +00:00
Rebecca Law
f7b3f9b06a - Remove the trailing comma from the first line of the "to" field
- Add client_reference to the activity CSV report
- Show the recipient on the CSV report the same way as the view activity page.
2020-01-10 16:00:40 +00:00
Rebecca Law
f8e7635a1d Show the first line of the address from the to field.
Now persisting the address to the "to" field of the Notification, after the notification has been validated.
If the letter is pending validation, then "Checking..." will appear as the identifier for the letter.
If the letter has passed validation, then the first line of the address (now persisted in the "to" field) will be displayed, with the client reference underneath.
If the letter has failed validation the "Provided as PDF" will show be displayed, which is now the initial value of the "to" field.
2020-01-10 16:00:40 +00:00
Rebecca Law
47ec4912db Merge pull request #3253 from alphagov/new-no-address-message
Added a new error message when the letter is missing an address block.
2020-01-10 15:44:47 +00:00
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
8e9b7ae368 Remove arguments from fixtures
These can't be used, since we fixtures can no longer be called as if
they were functions, so we can simply the code by removing them.
2020-01-10 12:17: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
Chris Hill-Scott
82a71c67df Make button more buttony
`role=button` for users of voice control software

`draggable=false` as per https://github.com/alphagov/govuk-frontend/pull/1020
2020-01-08 09:50:50 +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
Tom Byers
beeb273d6c Fix python tests broken by cookie banner 2020-01-03 17:28:33 +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