Commit Graph

4415 Commits

Author SHA1 Message Date
Ryan Ahearn
bb2d57b27b Update tests to use most recent jest and supporting libraries 2022-10-27 11:12:39 -04:00
Ryan Ahearn
4fce69f0ac Merge branch 'main' into cleanup-config
* main:
  lingering merge repair
  remove alerts from env
  remove broadcast-related code
2022-10-26 13:23:01 +00:00
Ryan Ahearn
d98e25180f Use nonexistant buckets in testing to verify mocks 2022-10-26 13:19:07 +00:00
stvnrlly
218eb3559f Merge branch 'main' into stvnrlly-remove-broadcasts 2022-10-26 01:27:44 +00:00
Ryan Ahearn
921c872bd1 Refactor method of retrieving credentials out of VCAP_SERVICES 2022-10-20 08:36:30 -04:00
Steven Reilly
04aba21296 Merge pull request #139 from GSA/stvnrlly-hide-letters
Hide letters in non-admin UI
2022-10-18 11:35:44 -04:00
stvnrlly
b6a6a14bc7 now with even fewer letters 2022-10-18 15:27:13 +00:00
Steven Reilly
345516606f Merge pull request #59 from GSA/stvnrlly-update-form-flow
Update services for post-sign-up tour
2022-10-17 09:43:32 -04:00
stvnrlly
44e8c0fe89 post-merge flake8 fix 2022-10-17 13:42:36 +00:00
Steven Reilly
3cabdf4f38 Merge branch 'main' into stvnrlly-hide-letters 2022-10-14 15:33:01 -04:00
stvnrlly
aac17bb2af get flake8's approval 2022-10-14 19:22:03 +00:00
stvnrlly
38fa1286b2 clean up admin ui & update tests 2022-10-14 18:58:55 +00:00
stvnrlly
a2c6c2f08c remove letters from dashboard 2022-10-13 20:51:45 +00:00
stvnrlly
067b4b3742 swap dollar symbols for pound symbols 2022-10-12 20:16:22 +00: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
Ryan Ahearn
a90dcc918b Provide s3 credentials for each individual bucket 2022-09-23 12:59:55 -04:00
Ryan Ahearn
7ce9f8cfcb Remove MOU bucket, for now 2022-09-21 23:18:15 -04:00
Ryan Ahearn
271cf7643d Connect to s3 buckets created by notifications-api 2022-09-21 23:18:10 -04:00
stvnrlly
947140bd60 isort has opinions, fine 2022-09-15 20:37:38 +00:00
stvnrlly
f2eaa120e4 satisfy flake8 2022-09-15 19:14:19 +00:00
stvnrlly
3e7b5b4370 update tests based on updated orgs 2022-09-15 18:47:04 +00:00
jimmoffet
f2b47c9e74 fix weird freeze_time decorator spacing 2022-09-13 13:34:45 -07:00
jimmoffet
4b5e659d3f fix weird pytest decorator spacing 2022-09-13 13:30:52 -07:00
jimmoffet
b7435aefed clean up comments 2022-09-13 13:18:25 -07:00
jimmoffet
24c9854ca6 testing for get_jobs in service dashboard 2022-09-13 13:16:17 -07:00
jimmoffet
c702104421 fix redis mocking for test runner 2022-09-12 17:38:53 -07:00
jimmoffet
e77e9200cd dummy phone 2022-09-09 17:16:01 -07:00
jimmoffet
69abec0bb3 change dashboard test to reflect demo changes to uploads view 2022-09-09 17:02:48 -07:00
jimmoffet
1f7fa07a79 finally fix redis 2022-09-07 21:32:33 -07:00
Ryan Ahearn
d3fa9318ef Changes to make isort happy 2022-08-09 14:31:04 +00:00
Ryan Ahearn
68129bc9f4 Address flake8 issues 2022-08-09 14:14:49 +00:00
jimmoffet
b465131338 all tests passing 2022-08-05 01:22:32 -07:00
jimmoffet
dad051a662 2767 passing 2022-08-05 00:25:03 -07:00
Jim Moffet
e17c26d1f6 config buckets 2022-06-23 14:08:29 -07:00
Ben Thorner
543be77776 Merge pull request #4258 from alphagov/speed-up-templates-page-179736794
Optimise load time for service "Templates" page
2022-06-08 13:37:58 +01:00
Chris Hill-Scott
b91babc67e Fix relative URLs in support tickets
When we get a support ticket we put a link to the service at the end.

As part of 8b7f2fbf04 we accidentally made
these URLs relative, rather than absolute. This means they aren’t made
into links by email clients or Zendesk.

This commit fixes the links to include the domain again.
2022-06-07 13:50:24 +01:00
Ben Thorner
5b52aa2381 Simplify test setup for Template List model 2022-06-07 11:31:10 +01:00
Ben Thorner
5db2581669 Simplify tests for TemplateList class
In response to: [^1][^2][^3].

Originally there were three tests:

- One was testing the "get_user_template_folders" method directly.

- The other two were testing "get_template_folders", which calls
the "_user_" method if a user is passed - this is what the tests
were primarily checking, by passing or not passing a User object.

The two tests of "get_template_folders" also implicitly checked
that it filtered folders based on a "parent_folder_id". I wanted
to emulate the tests but it makes more sense to simplify them, as
the methods are now only used by TemplateList internally.

To simplify, we just keep just two tests to check that the overall
set of folders is filtered based on the presence of a User. We do
lose the implicit check of filtering by "parent_folder_id", but:

- We are still checking this implicitly in the sense that the loop
to generate the overall set of folders terminates. If the method
didn't do any filtering, the loop would be infinite.

- We need to acknowledge that these tests were incomplete to begin
with. There is also lots of coverage in higher level tests [^4],
although it's harder to reason exactly what is covered.

[^1]: https://github.com/alphagov/notifications-admin/pull/4258#discussion_r890144076
[^2]: https://github.com/alphagov/notifications-admin/pull/4258#discussion_r890151220
[^3]: https://github.com/alphagov/notifications-admin/pull/4258#discussion_r890147506
[^4]: 1787f9f42f/tests/app/main/views/test_template_folders.py
2022-06-07 11:31:09 +01:00
Ben Thorner
bcfc6ce707 Decouple deletion tests from "get_templates" fn
Using create_template here is easier than template_json as it has
various parameters preset [^1].

[^1]: https://github.com/alphagov/notifications-admin/blob/master/tests/conftest.py#L3986
2022-06-07 11:05:33 +01:00
Ben Thorner
487dc1b488 Test _template_folders functions via TemplateList
This is part of the overall migration of the "_template_folders"
methods to the TemplateList class. Moving the existing tests now
will make the actual migration easier to follow.

To emulate the second and third tests, we need to grab a specific
folder from the TemplateList and then look at its folders - these
are set based on "get_template_folders" as before.
2022-06-07 11:05:30 +01:00
Ben Thorner
057b4ee7a5 Simplify tests for get_(user)_template_folders
This will make it easier to understand the diff when we move these
tests to operate via TemplateList. Despite the verbosity, the only
attribute we were actually checking here was the name, as a way of
identifying which folders had been returned.

Looking at the three tests:

1. The first is checking we can correctly filter all folders that a
user can access, which involves appending the names of any parent
folders the user doesn't have direct access to.

2. The second is checking the same thing but also that we filter the
set of folders to just the children of a parent.

3. The third is just checking the filtering of child folders, without
any user filtering or name aggregation applied.

I've adapted tests (2) and (3) to make it clearer what is tested,
focussing the tests on a specific folder and its contents.
2022-06-07 10:44:35 +01:00
Chris Hill-Scott
30eebf3586 Reorder and label test cases
This commit takes the existing test cases, removes duplicates, and tries
to add a human-readable comment explaining what each one is testing.
2022-06-06 15:10:27 +01:00
Chris Hill-Scott
ea9c7e6102 Use existing user fixture 2022-06-06 15:10:27 +01:00
Chris Hill-Scott
f779a97b5c Use decorator as decorator
This syntax makes it clearer what is being tested here, because it’s
unusual to see a decorator being manually called with function as its
first argument.

It’s also consistent with how the later tests in this file are written.
2022-06-06 13:55:25 +01:00
Chris Hill-Scott
122a045142 Define user inside each test
This user is only re-used once, which isn’t a big saving. By putting it
inside the test it’s easy to see what special conditions are being set
up that result in the expected outcometest result.
2022-06-06 13:46:39 +01:00
Chris Hill-Scott
60870c69a7 Split platform admin test out
By making the one platform admin case a separate test we no longer
need to pass in a `user` or `kwargs` to the parametrize every time,
making it easier to read.
2022-06-06 13:45:29 +01:00
Chris Hill-Scott
f79c3f27e3 Use fixture to create user dict
This removes a bunch of dummy data which isn’t relevant to the tests
being run.
2022-06-06 13:44:36 +01:00
Chris Hill-Scott
e6e2770a04 Rewrite test_permissions with parametrize
It’s easier to see what the different test cases are when they are laid
out with `parametrize`, rather than separate functions with lots of
boilerplate.
2022-06-06 13:43:46 +01:00
Chris Hill-Scott
15131d003b Let client_request do user mocking
`client_request.login` already mocks calls to get the current user, so
we don’t need to do it manually.
2022-06-06 13:41:52 +01:00