Commit Graph

1956 Commits

Author SHA1 Message Date
minglis
0c6193e2e9 Merge pull request #775 from alphagov/do-not-write-test-data-to-the-history-table
Do not write test data to the history table
2017-01-10 13:05:06 +00:00
Leo Hemsted
ea1afbe44f Merge pull request #789 from alphagov/utils-bump
bump utils to 13.0.1
2017-01-09 16:55:25 +00:00
Leo Hemsted
501187a9f4 bump utils to 13.0.1
brings in a fix to InvalidEmail/Phone/AddressExceptions not being
instantiated correctly. `exception.message` is not a python standard,
so we shouldn't be relying on it to transmit exception reasons -
rather we should be using `str(exception)` instead. This involved a
handful of small changes to the schema validation
2017-01-09 16:37:58 +00:00
Rebecca Law
098567c151 Merge pull request #785 from alphagov/check-notification_schema
Removed the oneOf validation in the get_notification_response schema.
2017-01-04 13:14:51 +00:00
Rebecca Law
bbdbb9079e Fixed the template uri for the post notification responses.
It was optimistic to think the v2 templates would be complete.
2017-01-04 11:22:50 +00:00
Rebecca Law
7f9111fd90 Removed the oneOf validation in the get_notification_response schema. 2017-01-04 11:00:47 +00:00
Rebecca Law
c8b11ffc8a Merge pull request #783 from alphagov/add-date-filter-to-get-services
Added a date range filter for the get all services end point.
2017-01-03 10:29:23 +00:00
Rebecca Law
0ec84ff5e8 Refactor the get_detailed_services so that the start and end date are not defaulted to None.
Set the start and end date to today's date if they are not set in the request.args
2016-12-29 13:50:41 +00:00
Rebecca Law
1de022f005 Update the query to execute immediately.
Fix indent.
Left a comment as to why start and end date are not set.
2016-12-29 13:28:55 +00:00
Leo Hemsted
8596cc500f Merge pull request #784 from alphagov/cloudfront-fix
don't use cloudfront on preview or staging
2016-12-29 12:23:52 +00:00
Leo Hemsted
d4f23f1e44 don't use cloudfront on preview or staging
cloudfront caching isn't set up on those environments yet, so continue
to use flask for now - in the future we'll want to revert this once
those environments are up and running properly
2016-12-29 12:15:47 +00:00
Leo Hemsted
9e27574298 Merge pull request #779 from alphagov/switch-to-cloudfront
use cloudfront instead of flask to serve static images
2016-12-29 11:35:05 +00:00
Rebecca Law
8ad078b663 Added a date range filter for the get all services end point.
When the start_date and end_date query argruments exists in the request,
the query will return the results from the NotificationHistory table for the given date range.
We will need to check the performance of this query, but this will only be used by the platform admin page.
2016-12-28 15:39:55 +00:00
Leo Hemsted
8c5c712f2b Merge pull request #781 from alphagov/subject-placeholder
fix placeholders not appearing in email subject
2016-12-22 15:35:44 +00:00
Rebecca Law
b2c293e53f Merge pull request #778 from alphagov/refactor-notify-user-endpoints
Refactor notify user endpoints
2016-12-22 14:50:12 +00:00
Leo Hemsted
3ed97151ee fix placeholders not appearing in email subject
it now switches utils.template.Template type, since the base Template
type now no longer has a subject attribute.

updated test case to use `sample_email_template_with_placeholders`
instead of `sample_email_template`
2016-12-22 14:40:33 +00:00
Rebecca Law
531cede6cf Merge pull request #777 from alphagov/log-notification-id-on-provider-call
Log notification ID on deliver tasks and in clients.
2016-12-22 14:09:23 +00:00
Leo Hemsted
bf0abce4a3 update python-client version
also unpin the patch version, since it shouldn't matter what patch
we're on provided that the function signatures are the same
2016-12-22 13:53:33 +00:00
Leo Hemsted
5cbe4eb5b2 use cloudfront instead of flask to serve static images
branding in emails was previously hosted from admin app - this changes
the url to be static.{domain}/images instead of {domain}/static/images,
which redirects to cloudfront.

some manipulation of the URL was required to make sure it still serves
locally rather than returning "static.localhost:6012" for example.

(if ADMIN_BASE_URL is localhost it just returns the old /static/
path)

also was able to remove DB interaction from a test. woo!
2016-12-21 16:35:16 +00:00
Rebecca Law
c6df84a8f3 Merge branch 'master' into do-not-write-test-data-to-the-history-table
Conflicts:
	app/dao/notifications_dao.py
2016-12-21 09:57:17 +00:00
Rebecca Law
7bec9aefcc Removed unused imports. 2016-12-20 16:06:23 +00:00
Rebecca Law
869b68d7af Refactor create_invited_user to persist and send message to the notify queue.
The reason for doing this is to ensure the tasks performed for the Notify users are not queued behind a large job, a way to
ensure priority for messages.

6th task for story: https://www.pivotaltracker.com/story/show/135839709
2016-12-20 15:59:31 +00:00
Leo Hemsted
6bf024569a Merge pull request #776 from alphagov/provider-audit
audit changes to provider_details table
2016-12-20 14:46:30 +00:00
Martyn Inglis
2d946736e0 Log notification ID on deliver tasks and in clients.
- help tie things together  in Kibana.
2016-12-20 13:24:08 +00:00
Rebecca Law
a03732472c Refactor send_user_reset_password to persist and send message to the notify queue.
The reason for doing this is to ensure the tasks performed for the Notify users are not queued behind a large job, a way to
ensure priority for messages.

5th task for story: https://www.pivotaltracker.com/story/show/135839709
2016-12-20 11:55:26 +00:00
bandesz
31b2c3f402 Fix apt proxy in Docker 2016-12-20 11:03:25 +00:00
Leo Hemsted
f1899c6d53 add updated_at to provider_details
it's set to utcnow from dao_update_provider_details
2016-12-19 17:45:46 +00:00
Rebecca Law
813947e7e4 Refactor send_already_registered_email to persist and send message to the notify queue.
The reason for doing this is to ensure the tasks performed for the Notify users are not queued behind a large job, a way to
ensure priority for messages.

4th task for story: https://www.pivotaltracker.com/story/show/135839709
2016-12-19 17:35:13 +00:00
Leo Hemsted
b39a027aeb test to make sure provider details history is bumped 2016-12-19 17:34:26 +00:00
Leo Hemsted
74cdcdcc92 set prov details history's primary key to be id+version 2016-12-19 17:33:51 +00:00
Leo Hemsted
9f88c310dc remove useless test from provider_details_dao tests 2016-12-19 17:13:11 +00:00
Leo Hemsted
8bb0261c79 dont let user update prov details version, and refactor tests
the provider details tests were previously very stateful - they
would update a value, and then because provider_details is a "static"
table that is not wiped by the notify_db_session fixture, the tests
were forced to make a second update that reverted that change. if the
test fails for whatever reason, the provider_details table ends up
permanently modified, playing havoc on tests further down the line.

this commit adds the fixture `restore_provider_details` to conftest.
this fixture stores a copy of the contents of ProviderDetails and
ProviderDetailsHistory tables outside of the session, runs the test,
and then clears the table and puts those old values in

this means that the tests have been cleaned up so that they do not
do operations twice in reverse. they've also been cleaned up
generally, including fixture optimisations and such
2016-12-19 17:13:10 +00:00
Leo Hemsted
9d1b1328af add version to provider_details and _history
set all existing rows to have a version of 1 (also copy across values
to populate the new provider_details_history table in the upgrade
script)

in dao_update_provider_details bump the provider_details.version by 1
and then duplicate into the history table as a new row
(done manually as opposed to the decorator used in template_history
since this is only edited in this one place and the decorator is icky)
2016-12-19 17:13:10 +00:00
Leo Hemsted
0136e1e32d fix invalid logging
the first argument to ANY logger.____ function is ALWAYS cast to a
string and used as a format argument for ALL remaining arguments
using %s formatting. even `logger.exception`, which just logs as
normal and then appends the stack trace.

so we shouldn't be passing `e` into logger.exception - just
`logger.exception('something went wrong!')`

also de-duplicated a test
2016-12-19 17:13:10 +00:00
Leo Hemsted
a197754906 add new provider_details_history table
* to be used for auditing changes to provider details
* not hooked in yet
* also made provider_details.active non-nullable. set all existing null
  provider_details.active to FALSE. none are set false on live so
  should hopefully be fairly uncontroversial
* refactored NotificationHistory.from_notification and update from noti
  to share with provider_details_history
2016-12-19 17:13:10 +00:00
Martyn Inglis
825db5e39d Ensure that all persist notification methods use service not service ID 2016-12-19 16:51:57 +00:00
Martyn Inglis
1e054ec698 Merge branch 'master' into do-not-write-test-data-to-the-history-table
Conflicts:
	app/user/rest.py
2016-12-19 16:47:54 +00:00
Martyn Inglis
0f37824b0c Ensure updates on a research mode service or test key don't touch the history table
- note this is an unexpectedly big change.
- When we create a service we pass the service id to the persist method. This means that we don't have the service available to check if in research mode.
- All calling methods (expecting the one where we use the notify service) have the service available. So rather than reload it I changed the method signature to pass the service, not the ID to persist.
- Touches a few places.

Note this means that the update or create methods will fall over on a null service. But this seems correct.

Goes back to the story which we need to play to make the service available as the API user so that the need to load and pass around services is minimised.
2016-12-19 16:45:18 +00:00
Rebecca Law
ab1326b97e Merge pull request #774 from alphagov/refactor-send_user_email_verification
Refactor the endpoint to send user email verification when registering
2016-12-19 16:29:02 +00:00
Rebecca Law
b233e82121 Merge pull request #773 from alphagov/refactor-confirm-new-email
Refactor endpoint to confirm new email
2016-12-19 16:28:44 +00:00
Rebecca Law
bcbfb0851b Fix extra space in test 2016-12-19 15:33:30 +00:00
Rebecca Law
741cbd1741 Refactor send_user_email_verification to persist the notification then put on the "notify" queue for delivery.
The reason for doing this is to ensure the tasks performed for the Notify users are not queued behind a large job, a way to
ensure priority for messages.
2016-12-19 15:31:54 +00:00
Rebecca Law
75ca86ad0d Update the send_user_confirm_new_email to persist the notification then put on the "notify" queue for delivery.
The reason for doing this is to ensure the tasks performed for the Notify users are not queued behind a large job, a way to
ensure priority for messages.
2016-12-19 15:19:05 +00:00
Martyn Inglis
35aa888658 When creating a notification don't create a history row if:
1) research mode service
2) test mode key

Stop test data getting into history and subsequently into stats and so on.
2016-12-19 13:57:06 +00:00
imdadahad
fb114f4c80 Merge pull request #772 from alphagov/fix-v2-uri
Fix uri validation in v2 responses
2016-12-16 15:53:26 +00:00
minglis
9c161df2b6 Merge pull request #771 from alphagov/fix-missing-template-id
Fix for missing template IDs.
2016-12-16 14:41:54 +00:00
imdadahad
27952e96e0 Add comment for e.path schema validation fix
Add comment for e.path in schema validation and use popleft()
2016-12-16 12:41:19 +00:00
Rebecca Law
be9861c867 Merge pull request #769 from alphagov/add-log-to-ses-callback
Added logging when the SES callback is successful.
2016-12-16 11:58:43 +00:00
Rebecca Law
408048f478 Merge pull request #768 from alphagov/fix-status-type
Update the timeout notifications to use technical-failure
2016-12-16 11:50:48 +00:00
Rebecca Law
40dca7f9c7 Changed the timeout notications update query to set notifications still in created to a technical-failure and notifications still in sending or pending are set to a temporary-failure 2016-12-16 11:40:58 +00:00