Commit Graph

2849 Commits

Author SHA1 Message Date
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
Rebecca Law
673a0d64d0 Refactor mock_get_uploads to return more realistic data. 2019-12-06 13:22:25 +00:00
Rebecca Law
f9e01e0b45 Fix unit tests and put the antivirus check back in 2019-12-06 10:22:23 +00:00
Tom Byers
db3bcee236 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-06 08:20:49 +00:00
karlchillmaid
cb7d0e3813 Merge pull request #3215 from alphagov/add-contraction-to-errors
Update error messages
2019-12-04 12:34:04 +00:00
karlchillmaid
7717d5131e Fix test content 2019-12-04 12:03:07 +00:00
karlchillmaid
bdde0daeec Fix test content 2019-12-04 12:01:26 +00:00
Leo Hemsted
3be9150dcf change letter previews to be in the no_cookies blueprint
this blueprint should be applied to every endpoint that is loaded async
(as in via a src tag on an img, iframe, etc)
2019-12-03 17:06:15 +00:00
Pea M. Tyczynska
0d8824c3e9 Merge pull request #3193 from alphagov/validate-against-empty-messages
Validate CSVs against rows with empty messages
2019-12-03 14:12:04 +00:00
Pea Tyczynska
9e0c8167ee Content changes to error messages 2019-12-03 13:36:54 +00:00
Pea Tyczynska
64b35ba337 Add addtional test cases for row errors 2019-12-03 13:36:53 +00:00
Pea Tyczynska
f265dde8ab Validate CSVs against rows with empty messages 2019-12-03 13:36:41 +00:00
Leo Hemsted
6ad9ec8d21 flake8 2019-11-29 15:25:37 +00:00
Chris Hill-Scott
41113081f3 Merge pull request #3201 from alphagov/remove-letter-validation-preview
Remove the letter validation preview endpoints
2019-11-27 15:53:27 +00:00
Pea M. Tyczynska
5e60095584 Merge pull request #3200 from alphagov/finetune-letter-uploads-valdiation-failed
Add re-upload button and back link to the preview page
2019-11-27 15:17:19 +00:00
Pea Tyczynska
02beccd066 Add re-upload button and back link to the preview page
Re-upload button is only shown if file failed validation.

Change wording of re-upload buttons

Make test we test right buttons on letter upload preview page

Also remove double backlink
2019-11-27 15:11:14 +00:00
Chris Hill-Scott
b9de27d1c2 Remove the letter validation preview endpoints
We can use the ‘Uploads’ feature to check if letters are printable now.

This code works in a completely different way, so if we kept it we’d
have to maintain two different code paths, and make sure that they
didn’t diverge.

Also deletes the related HTML templates.
2019-11-27 14:28:42 +00:00
Tom Byers
2ded09a8b9 Fix tests broken by GOV.UK Frontend template
Fix test broken by removal of GOV.UK logo image
- tests/app/main/views/test_notifications.py

Fix tests that ref GOV.UK template CSS files
- tests/app/main/views/test_index.py

Fix test broken by govuk-visually-hidden
- tests/app/main/views/test_send.py

Fix tests broken by header menu link -> button
- tests/app/main/views/test_service_settings.py
- tests/app/main/views/test_template_folders.py

Fix tests broken by removing div#content
- tests/app/main/views/accounts/test_choose_accounts.py
- tests/app/test_navigation.py

Remove references to GOV.UK CSS
- tests/app/main/views/test_index.py

Fix tests querying the header navigation
- tests/app/test_navigation.py
2019-11-27 14:15:32 +00:00
Tom Byers
c1b8fb7531 Replace all visually-hidden classes
These have been replaced:

https://design-system.service.gov.uk/get-started/updating-your-code/#helper-class-names
2019-11-27 14:15:32 +00:00
Chris Hill-Scott
0d202786d0 Show who the recipient is even in trial mode
Trial mode should let you preview the letter the same as live mode,
except for being able to actually end the letter.

Showing the recipient helps people understand how the feature works.
2019-11-27 12:11:32 +00:00
Chris Hill-Scott
bf385486cf Update test with multiple placeholders added
It wasn’t possible to test for this before because the order of
placeholders was non-deterministic. The order has been made
deterministic in https://github.com/alphagov/notifications-utils/pull/674
2019-11-27 11:30:14 +00:00
Chris Hill-Scott
534be751dd Make developer instructions more explicit
The previous ‘you need to update your API calls’ text isn’t clear enough
now that the context of the spreadsheet has been removed.
2019-11-27 10:37:29 +00:00
Chris Hill-Scott
fcadab3ce8 Remove spreadsheet example from breaking change
Since we’re only showing this page to team who are using the API we
don’t have to worry about explaining what’s going on in terms of the
spreadsheet any more.

This makes the page simpler.
2019-11-27 10:37:29 +00:00
Chris Hill-Scott
dbc85fcc1f Only show breaking change page to API users
We introduced the ‘breaking change’ page[1] partly to help teach people
about the relationship between the placeholders in their template and
the data they were providing. Data can be provided either by API or by
uploading a spreadsheet. The users who we struggled to communicate this
relationship to were the ones using the upload a spreadsheet feature.

We made two changes to the context of this feature:

1. Around the same time we introduced the interactive tour[2], which
   ultimately proved to be the thing that helped people understand the
   relationship between the data they were providing and the
   placeholders in the template.

2. We introduced a way for people to send one-off messages without
   using the API or uploading a spreadsheet[3]. So for this page to say
   that you’ll need to update a spreadsheet or change an API call if you
   change the placeholders in your template is no longer accurate.

Therefore I think it makes sense to only show this page to teams who are
using the API to send messages. The best proxy we have for that is to
look at whether they’ve created any API keys.

***

1. https://github.com/alphagov/notifications-admin/pull/631
2. https://github.com/alphagov/notifications-admin/pull/613
3. https://github.com/alphagov/notifications-admin/pull/1293
2019-11-27 10:37:28 +00:00
Tom Byers
e09d510ab8 Revert "Replace govuk template with govuk frontend components - rewrite" 2019-11-26 12:14:09 +00:00
Tom Byers
9ac9c6d7d6 Fix tests broken by GOV.UK Frontend template
Fix test broken by removal of GOV.UK logo image
- tests/app/main/views/test_notifications.py

Fix tests that ref GOV.UK template CSS files
- tests/app/main/views/test_index.py

Fix test broken by govuk-visually-hidden
- tests/app/main/views/test_send.py

Fix tests broken by header menu link -> button
- tests/app/main/views/test_service_settings.py
- tests/app/main/views/test_template_folders.py

Fix tests broken by removing div#content
- tests/app/main/views/accounts/test_choose_accounts.py
- tests/app/test_navigation.py

Remove references to GOV.UK CSS
- tests/app/main/views/test_index.py

Fix tests querying the header navigation
- tests/app/test_navigation.py
2019-11-25 11:43:30 +00:00
Tom Byers
2bd7ce8cf6 Replace all visually-hidden classes
These have been replaced:

https://design-system.service.gov.uk/get-started/updating-your-code/#helper-class-names
2019-11-25 11:43:30 +00:00
Tom Byers
e02f94f238 Revert "Replace govuk template with govuk frontend components" 2019-11-25 10:37:35 +00:00