Commit Graph

714 Commits

Author SHA1 Message Date
Andrew Shumway
f51d4be8de Add tests with notify.gov/usnotify as default 2023-11-20 10:06:17 -07:00
Andrew Shumway
654b406827 Added/fixed tests to remove notify from message flow 2023-11-17 11:19:26 -07:00
Andrew Shumway
af119aad1c Fixed parameter in client request 2023-11-02 16:28:07 -04:00
Andrew Shumway
62a09c5223 Added mock to client request for get request of count 2023-11-02 16:27:01 -04:00
Kenneth Kehl
b487a915f6 fix remaining tests 2023-10-30 08:42:11 -07:00
Carlo Costino
47695b97d3 Address flake8-pytest-style issues with conftest.py
Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
2023-10-12 10:24:48 -04:00
Kenneth Kehl
ab71be0246 merge from main 2023-09-19 10:31:33 -07:00
Carlo Costino
d02d2de9dc Made a few adjustments to test the beta redirect:
- Explicitly return the redirect
- Change the redirect to be a 302 instead of 301
- Adjusted the test client to allow sub domains
- Added the remaining tests

A big thank you to @A-Shumway42 for getting this work underway!

Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
2023-09-18 15:59:28 -04:00
Kenneth Kehl
0218ffd9ba notify-admin-761 remove basic auth 2023-09-14 07:47:38 -07:00
Kenneth Kehl
91f1790c89 fix up 2023-09-13 12:16:43 -07:00
Kenneth Kehl
93e4d1b4bb fix whoops 2023-09-12 10:45:42 -07:00
Kenneth Kehl
29ea098fd3 make some progress 2023-09-08 12:53:35 -07:00
Kenneth Kehl
cc8f8dfcc2 initial 2023-09-08 08:38:27 -07:00
Kenneth Kehl
8c9721d8e2 notify-api-412 use black to enforce python coding style 2023-08-25 09:12:23 -07:00
Carlo Costino
d79e15c2a1 Clean up state of E2E tests
This changeset takes care of leaving E2E tests in a clean state so that
we can revisit the work later.  The efforts to add authentication
support did not pan out, so we will go a different route in the near
future.

Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
2023-08-24 15:31:21 -04:00
Carlo Costino
9e609efa1c Remove webauthn hooks
This changeset removes webauthn from the Notify.gov admin app.  We are not using webauthn at all in our implementation and will be looking at an entirely different authentication system in the near future.

Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
2023-08-14 16:59:38 -04:00
Carlo Costino
b5664c3d20 Add support for E2E (end-to-end) tests (#625)
This changeset lays the foundation for supporting E2E (end-to-end) integration tests for US Notify.  It brings in the Playwright testing framework along with the Playwright pytest plugin to make this possible, and includes the following adjustments:

- A new test session fixture for ensuring that Playwright authenticates with the sites that are currently behind HTTP Auth (requies env-var config)
- A new end_to_end test directory specifically for E2E tests
- Updates to the Makefile that make sure E2E tests are not run as a part of the normal test routine but can be run separately
- A new command in the Makefile to run E2E tests that will run in Chromium, Firefox, and Webkit headless browsers

Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
2023-07-28 09:31:45 -04:00
Steven Reilly
13d0e46b52 blunt rename of org (#620) 2023-07-12 12:09:44 -04:00
Jonathan Bobel
f342e0fb6c Updating site to use USWDS styles (#509)
* Updated header and footer
* Updated fonts
* Moved files around and updated gulpfile to correct the build process when it goes to production
* Adjusted grid templating
* Added images to assets
* Update app/templates/components/uk_components/footer/template.njk

Co-authored-by: Steven Reilly <stvnrlly@users.noreply.github.com>
2023-06-06 15:28:24 -04:00
Ryan Ahearn
a42617f776 Add logging around auth{entication,orization} calls 2023-04-26 11:25:24 -04:00
Ryan Ahearn
de668d7aba Remove contact-list references from code 2023-04-12 15:35:14 -04:00
Ryan Ahearn
2ad21a6f4f Replace UK phone numbers in tests with US numbers 2023-01-06 11:19:56 -05:00
stvnrlly
cc4f8916b3 remove letter template preview 2022-12-05 16:40:59 -05:00
stvnrlly
36e0e67afc remove pdf stuff 2022-12-05 16:22:19 -05:00
stvnrlly
944715ac46 big commit with letters removal 2022-12-05 15:33:44 -05:00
stvnrlly
a8b8d09fb7 post-gray test updates 2022-12-02 10:30:37 -05:00
stvnrlly
a2b58c926e more test fixes & letter trimming 2022-11-22 22:50:47 -05:00
stvnrlly
ca1897973a test time fixes and bonus letter removal 2022-11-22 17:03:42 -05:00
stvnrlly
f16b5dd1c4 remove broadcast-related code 2022-10-04 03:04:13 +00:00
Ryan Ahearn
5f1a1f083a Proactively specify aws region for s3 operations 2022-09-26 10:25:03 -04:00
jimmoffet
dad051a662 2767 passing 2022-08-05 00:25:03 -07:00
Ben Thorner
1b96a13565 Add xfail tests for go-live reply-to/sender check
This represents a bug where a user can request to go live without
setting a reply-to email address or SMS sender despite the service
having one or more email or SMS templates, respectively.

We will make these tests pass in the next commit.
2022-05-27 12:46:36 +01:00
Ben Thorner
4abb6110c8 Fix keys used to render monthly usage
These were out-of-sync with the API.
2022-05-11 13:28:33 +01:00
Ben Thorner
bb0fb73bc8 Minor tweaks in response to PR comments
In response to [^1] and [^2].

[^1]: https://github.com/alphagov/notifications-admin/pull/4229#discussion_r869181152
[^2]: https://github.com/alphagov/notifications-admin/pull/4229#discussion_r869186063
2022-05-10 17:00:51 +01:00
Ben Thorner
3449ccd923 Support multiple SMS rates per month on usage page 2022-05-03 16:01:13 +01:00
Ben Thorner
fb7c116046 Finish migration from billing_units to API fields
This is now only used for letters and represents the number sent
[^1].  We could use the chargeable_units field, but using "_sent"
is more consistent with the annual attributes [^2].

In fact, chargeable_units isn't actually used anywhere, but I've
kept it in the test data as it is part of the real API and helps
clarify the other values for SMS - free vs. charged.

Note: for SMS I've used an arbitrary "1234" for "chargeable_units"
to indicate it's not used and may be different to the number sent -
for SMS it's related to the number of fragments.

[^1]: bb62d22f25/app/dao/fact_billing_dao.py (L339)
[^2]: 3a1ac189ff/app/main/views/dashboard.py (L339)
2022-05-03 16:01:08 +01:00
Ben Thorner
c0ee24ff19 Migrate letter cost calculation to use API field
The values in the tests are calculated manually from other fields
in the mocked API response.
2022-05-03 16:01:07 +01:00
Ben Thorner
d798a0d60f Replace manual SMS monthly calculations with API
This starts using the sms_{cost, charged, free_allowance_used}
fields in the new API to replace the "get_free_paid_breakdown"
function we had before, which could not support multiple rates.

In order to use "get_free_paid_breakdown" the calling method had
to store a "cumulative" variable to calculate the free allowance
used so far, which is now done by the API.

To calculate the data for conftest.py, I had to start from the
bottom ("April") and manually calculate the free allowance used
to emulate the API - this is what "cumulative" used to do.
2022-05-03 16:01:06 +01:00
Ben Thorner
ce8bdea9be Fix inaccurate test data for monthly usage API
It has never been possible to get multiple rows for the same month
and rate. This was making it hard to switch to the new API fields,
which will require some manual calculations. I've added the billing
units together in the remaining data so the tests still pass.

I've also moved the "April" row to the end as it was out-of-order
with all the others: it's the _start_ of the financial year.
2022-05-03 16:01:03 +01:00
Ben Thorner
4ab7e3ceec Rename billing API methods to be recognisable
I struggled to distinguish which was which as neither mentioned if
the data they returned was monthly or annual.
2022-05-03 16:00:57 +01:00
Ben Thorner
e6c04ef556 Support variable rates for annual usage stats
Note: I've removed the pricing assertion in the "0_free_allowance"
test as it's covered elsewhere - the value of the test is really to
check that we don't show the remainder if there never was any.
2022-04-27 17:06:17 +01:00
Ben Thorner
e0aa51c306 Use new "cost" field in usage APIs
The previous, manual calculation could be incorrect depending on
which SMS rates the free allowance was attributed to.

The new field also supersedes the old "letter_total" bolt-on so we
can get cost information consistently for both types.
2022-04-27 17:06:12 +01:00
Ben Thorner
82c3e8093d Remove redundant SMS test data for annual usage 2022-04-27 16:58:18 +01:00
Ben Thorner
c6f5467009 Extend main test for service usage page
This adds missing assertions for email and SMS usage, as well as
letters with the help of some additional test data.

Previously we were only checking monthly usage (in other tests).
2022-04-27 16:57:06 +01:00
Ben Thorner
55ea5d90c7 Migrate away from ambiguous "billing_units"
This uses two new fields in the annual usage API instead of the
old one, which was actually a mix of two kinds of data [^1].

[^1]: fc378fed96
2022-04-27 16:32:52 +01:00
Ben Thorner
a02e1adbc5 Tweak usage dashboard test to cover rate changes 2022-04-26 14:02:54 +01:00
Ben Thorner
411abb136a Make broadcast user fixtures realistic
A broadcast service user will have the permission on creation [^1].

[^1]: b145a29935/app/dao/broadcast_service_dao.py (L69)
2022-03-24 12:26:06 +00:00
Chris Hill-Scott
b998b6bb20 Remove methods for checking service/org name uniqueness
We don’t use these now – instead we try to update the name and see if
it works or not.
2022-01-13 10:16:07 +00:00
Chris Hill-Scott
0ad106f572 Mark client fixture as ‘private’
No tests are now using the `client` fixture directly so we can rename
it.

Python convention is to use an `_underscore` for things which should be
considered semi private.

This should discourage people from writing new tests with these old
fixtures.

New tests should always use `client_request`.

Want to be logged in with a different user? Call
`client_request.login(user)` first.

Don’t want to be logged in? Call `client_request.logout()` first (most
of our tests need to be logged in).

Need an instance of `Response` object not an instance of
`BeautifulSoup`? Use `client_request.get_response` or
`client_request.post_response`.

Need to pass in a URL, not arguments to `url_for`? Use
`client_request.get_url(…)` or `client_request.post_url(…)`.

Need to pass in a URL and get a response back? Use
`client_request.get_response_from_url(…)` or
`client_request.post_response_from_url(…)`.
2022-01-10 14:39:46 +00:00
Chris Hill-Scott
6540701aa7 Replace uses of client to set request context
Some tests use the `client` fixture but don’t call any of its methods.
The reason for doing this is because the test depends on something in
the request context.

This commit replaces all those instances with `client_request`, which
also sets the request context.

These tests are the last ones that still use the `client` fixture. By
replacing it with `client_request` we will be able to say that no tests
should be using the `client` fixture directly.
2022-01-10 14:39:46 +00:00