Commit Graph

1412 Commits

Author SHA1 Message Date
Martyn Inglis
9ec52eac02 New config style 2016-07-29 10:15:34 +01:00
Martyn Inglis
7bd1ea1a45 Wrong path to app 2016-07-29 10:15:33 +01:00
Martyn Inglis
d34ae9edbc Fixed some bash if blocks and removed env file from db.py 2016-07-29 10:15:33 +01:00
Martyn Inglis
0bfed1baad Fixing up configs 2016-07-29 10:15:33 +01:00
Martyn Inglis
26890c6436 Added basic elb/instance lookups 2016-07-29 10:15:33 +01:00
Martyn Inglis
0933c153ea Added notify-app if/else block so can run on new staging and preview 2016-07-29 10:15:33 +01:00
Leo Hemsted
e5b0d568fa ensure stats returned for lifespan of service
even if they've never sent a notification for realsies
2016-07-28 15:24:21 +01:00
Leo Hemsted
8ad47481d7 add GET /service/<id>/notifications/weekly
moved format_statistics to a new service/statistics.py file, and
refactored to share code. moved tests as well, to try and enforce
separation between the restful endpoints of rest.py and the logic/
data manipulation of statistics.py
2016-07-28 13:48:39 +01:00
Leo Hemsted
ce9f2e808b Merge pull request #560 from alphagov/notification-500
fix notification 500
2016-07-27 17:16:45 +01:00
Leo Hemsted
444132ad66 rewrite weekly aggregate function to honor week boundaries
(and not use the stats table, and also be easier to read)
2016-07-26 17:23:59 +01:00
Adam Shimali
183fc7d639 After doing some tests locally. To get this to run in a reasonable
amount of time I've made the following changes.

Only migrate jobs for the Digital Marketplace service.

Batch up commits to run per job.
2016-07-26 16:23:36 +01:00
Leo Hemsted
91393bdb0d ensure /notifications rather than service/:id/notifications in tests
for content merging
2016-07-26 15:09:25 +01:00
Leo Hemsted
48eff9a2ee add today_only flag to GET /service/:id
if both detailed=True and today_only=True are passed in, the stats
returned will only be for today.

if detailed is false or not specified, today_only has no effect
2016-07-26 14:35:29 +01:00
Leo Hemsted
fd96c854e1 add dao function to get notification stats for a server for toady only 2016-07-26 14:35:29 +01:00
Leo Hemsted
c81b30dba1 separated schemas once more into "with template" and "with personalisation"
"with personalisation" should only be used by the public notification api
"with template" should be used when we want template name, etc details.

also added an xfail test for correctly constructing notification
personalisation
2016-07-26 14:34:59 +01:00
Leo Hemsted
b28e7efd14 dont load template contents for job page
rename the notification_status_schema to make it apparent that it
involves the template, and then don't use it on the job page - the
job page doesn't do anything with the data. won't somebody think of
the cpu cycles! (also means it ignores problems with template
versions)
2016-07-26 14:34:59 +01:00
minglis
95af32f289 Merge pull request #556 from alphagov/fix-expired-token-error
Fix bug with expired token error response
2016-07-26 11:25:09 +01:00
minglis
cd4e271dcf Merge pull request #557 from alphagov/fix-inconsistent-tests
make tests run consistently
2016-07-26 11:24:44 +01:00
Leo Hemsted
3df0e8ee2d make tests run consistently
* tests on API endpoints that we do not explicitly sort should
  either sort the results or compare results in an orderless way
  (e.g. converting to a set)
* tests that touch the provider_details should reset values after
  running, since the provider_details table is not torn down and
  re-created between tests (unlike most tables)
2016-07-25 09:47:38 +01:00
minglis
c92bac0895 Merge pull request #558 from alphagov/allow_overriding_of_database_connection_in_tests
Override postgresc connection for jenkins
2016-07-22 21:02:16 +01:00
Martyn Inglis
a5b8a41ead Override postgresc connection for jenkins
If TEST_DATABASE is set then the postgres connection is set to that.
Jenkins sets it to the RDS instance that is in that AWS Account
2016-07-22 20:47:50 +01:00
Rebecca Law
ecd4b76080 Fix bug with expired token error response 2016-07-22 15:10:37 +01:00
Leo Hemsted
85c7aa4a40 Merge pull request #540 from alphagov/dashboard-notifications-api
detailed service api endpoint
2016-07-22 14:18:11 +01:00
Leo Hemsted
e6d85644e4 Merge pull request #552 from alphagov/update-utils-markdown-branding
Update utils for Markdown parsing + subbranding
2016-07-22 14:17:50 +01:00
Adam Shimali
58dece0049 Merge pull request #553 from alphagov/statsd-bugfix
Statds value error
2016-07-22 14:16:21 +01:00
Adam Shimali
cfd42a8a05 Statsd timings were being passed a timedelta instead for float for
milliseconds.

Bugfix for https://www.pivotaltracker.com/story/show/126852733
2016-07-22 12:13:24 +01:00
Chris Hill-Scott
68fd4947cb Update utils for Markdown parsing + subbranding
Markdown parsing (will be active but isn’t documented):
- [x] https://github.com/alphagov/notifications-utils/pull/54

Email sub branding (not used yet):
- [x] https://github.com/alphagov/notifications-utils/pull/55

Required modification to the email preview endpoint to make sure that
it only included the message and not any HTML.
2016-07-22 11:09:23 +01:00
Chris Hill-Scott
0622791e83 Merge pull request #547 from alphagov/only-character-limit-sms
Only put a character limit on SMS notifications
2016-07-21 17:30:20 +01:00
Chris Hill-Scott
c38962e91a Only put a character limit on SMS notifications
We limit SMS to be a maximum of 495 characters at the point of an
API call being made.

We were also applying this limit to emails, which is wrong.
2016-07-21 16:33:21 +01:00
Leo Hemsted
3b552139ce add tests for dao 2016-07-21 14:04:25 +01:00
Leo Hemsted
2d1babf2bb 'detailed' flag on GET /service/<uuid>
if passed in, returns the service object with additional statistics
dictionary, which will be used in the admin app to populate dashboard
components. A new schema has been created for this to avoid clashing/
causing confusion with the existing schema, which is already used
for PUT/POST as well, and this schema can be easily tailored to
reduce ambiguity and lazy-loading
2016-07-21 14:04:25 +01:00
Leo Hemsted
a355f3e544 add idparametrize pytest decorator
so you can specify test IDs in a reasonable dictionary syntax,
which is useful when the parameters may not be immediately
self-explanatory
2016-07-21 14:04:25 +01:00
Leo Hemsted
67542280f5 remove unused user_id option from GET /service/<service_id> 2016-07-21 14:04:25 +01:00
Leo Hemsted
964ea1954c Merge pull request #538 from alphagov/services-speed-up
Speed up GET services endpoints
2016-07-21 14:03:44 +01:00
Rebecca Law
bdcddfbea3 Merge pull request #543 from alphagov/use-new-mmg-api
Use the new mmg api
2016-07-20 10:45:57 +01:00
Rebecca Law
c8ad5362eb Moved mmg_url to configs.
Fix up the tests
2016-07-20 10:40:50 +01:00
Adam Shimali
3b8a163ff2 Db migration to retrospectively create notification history from
jobs table.

The migration selects only jobs from after the go live date and before
the earliest record in notication history table.
2016-07-19 16:46:17 +01:00
Rebecca Law
30f7377d7e Fix tests 2016-07-19 16:16:12 +01:00
Rebecca Law
aca23472e3 Use the new mmg api 2016-07-19 15:27:52 +01:00
Chris Hill-Scott
ae85baf810 Merge pull request #539 from alphagov/upgrade-bleach
Upgrade bleach to fix dodgy html5lib version
2016-07-19 09:11:00 +01:00
Chris Hill-Scott
ba1c1fd07a Upgrade bleach to fix dodgy html5lib version
Bleach 1.4.2 installs html5lib version 0.999 or greater.

This was fine, until version 0.999999999 (nine nines was released, which
doesn’t work.

Bleach 1.4.3 pins html5lib to 0.9999999 (seven nines), which stops the
bad version getting installed.
2016-07-15 13:39:23 +01:00
Leo Hemsted
566ae798df Speed up GET services endpoints
Add additional relationships to exclude in the ServiceSchema metaclass.
Marshmallow by default lazily loads relationships when dumping, so any
relationships we know we won't need, we can exclude and avoid a DB call.
Lots of tables are linked to services, so it loads a lot of tables.
So don't load statistics tables, since they're clearly not needed.

We *do* however want to return the users for the service - they're used
in a few places. If we're returning all services, then we don't want to
make separate queries for these users, so we modify the services_dao
queries to load users the first time round. This should speed up all
GET queries to the services endpoints, most notably pages that get many
services (platform_admin, choose service, login)
2016-07-15 12:04:38 +01:00
Chris Hill-Scott
327b0dcd02 Merge pull request #525 from alphagov/update-bootstrap
updated bootstrap
2016-07-15 10:36:32 +01:00
Leo Hemsted
f034f99b8d Update bootstrap.sh
force python3 when creating virtualenv
2016-07-15 10:24:44 +01:00
Chris Hill-Scott
19dc2c5d99 Merge pull request #532 from alphagov/email-formatting-and-optional-placeholders
Add conditional placeholders and formatting of email messages
2016-07-15 10:13:00 +01:00
Adam Shimali
6f1063ba7f Merge pull request #533 from alphagov/message-limit-fix
Daily message limit imposed for service api calls.
2016-07-14 13:37:07 +01:00
Adam Shimali
9f9040869d Daily message limit imposed for service api calls. 2016-07-14 11:25:45 +01:00
Chris Hill-Scott
a4a934f6ba Add formatting of emails, conditional placeholders
Implements and depends on:
- [x] https://github.com/alphagov/notifications-utils/pull/45
- [x] https://github.com/alphagov/notifications-utils/pull/47
- [x] https://github.com/alphagov/notifications-utils/pull/48
- [x] https://github.com/alphagov/notifications-utils/pull/50
- [ ] https://github.com/alphagov/notifications-utils/pull/51
- [ ] https://github.com/alphagov/notifications-utils/pull/52

Should be deployed ahead of the admin side of these features, which
is in: https://github.com/alphagov/notifications-admin/pull/781
2016-07-13 15:10:54 +01:00
Leo Hemsted
496bc05eea Merge pull request #526 from alphagov/notifications-shadow-table
Notification history table
2016-07-12 13:52:08 +01:00
Rebecca Law
dbd888a891 Merge pull request #529 from alphagov/add-queue
Add queue for email-already-registered tasks.
2016-07-12 13:49:09 +01:00