Commit Graph

16 Commits

Author SHA1 Message Date
Rebecca Law
f66670c558 - Added logging to indicate that we created the notification and that we sent the notification to a delivery queue.
- Small updates as recommended by review comments.
2017-01-18 09:56:26 +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
Imdad Ahad
7634c2e772 Add robustness to our v2 schema error messages:
* Ensure we dont raise exception if e.cause does not contain a message
* Ensure we handle case where e.path may be empty
* Refactor existing tests to conform to new format
2016-12-15 16:39:15 +00:00
Rebecca Law
db6db2e121 Renamed test, it was a duplicate name 2016-12-15 16:30:38 +00:00
Rebecca Law
7a623de171 Added boby and subject to the get_notifications schema 2016-12-15 16:19:55 +00:00
Imdad Ahad
52130e8ba4 Refactor tests 2016-12-12 18:06:14 +00:00
Imdad Ahad
620a90fd7c Make get_notifications return single notification by reference 2016-12-07 14:09:56 +00:00
Paul Craig
4082d38c0c Test invalid older_than, template_types, and bad ids
Come up with some simple tests in the routes, just to see we get
back what we expect as errors.
2016-11-28 15:56:59 +00:00
Paul Craig
2ca675eb73 Test invalid statuses and template_types
Run through a few scenarios in the `test_schema_notifications.py`
test file, calling `.validate()` on some data instead of actually
calling the route.
2016-11-28 15:10:13 +00:00
Paul Craig
ab990679b3 Replace marshmallow with jsonschema
Created a new schema that accepts request parameters for the
get_notifications v2 route.
Using that to validate now instead of the marshmallow validation.

Also changed the way formatted error messages are returned because
the previous way was cutting off our failing `enum` messages.
2016-11-28 14:22:51 +00:00
Paul Craig
9b1375ba84 URLs in API responses have full URL 2016-11-28 11:13:11 +00:00
Paul Craig
df7450698c Test returning notifications by "?status=failed"
Check that all failure states are returned by asking for
notifications of type "failure".
2016-11-25 15:26:40 +00:00
Paul Craig
640f51fc0a Add tests for getting back lists of notifications 2016-11-25 15:23:04 +00:00
Paul Craig
1fce30aaa7 Cost savings
The "cost" value was flawed for a couple of reasons.

1. Lots of messages are free, so in those instances the "cost"
   doesn't tell you anything
2. The query to get the rate was expensive and we don't have
   an obvious way to get it back very efficiently for large numbers
   of notifications.

So we scrapped it.
2016-11-25 15:23:03 +00:00
Paul Craig
92897e20a8 Test returning a notification with a non-zero cost
Our previous test ws returning a notification without a `sent_by`
attribute, which meant that cost was always 0.
Unfortunately, this meant that returning a real value for cost was
untested and (whaddya know) it broke immediately.

Old test scenario:
- billable_units=1, sent_by=None, cost=0

New scenarios
- billable_units=0, sent_by='mmg', cost=0
- billable_units=1, sent_by='mmg', cost=1
2016-11-22 18:01:16 +00:00
Paul Craig
9758b96a2b Create 'v2' get notification route
The new 'v2' API wants to return less data than the previous one,
which was sending back tons of fields the clients never used.

This new route returns only useful information, with the JSON
response dict being built up in the model's `.serialize()` method.

Note that writing the test for this was a bit painful because of
having to treat loads of keys differently. Hopefully we think this
is a good way to write this test, because if we don't, we should
start thinking of a better way to check the values are what we
expect.
2016-11-21 15:41:49 +00:00