Commit Graph

12 Commits

Author SHA1 Message Date
Leo Hemsted
fb510d2522 only set organisation on GET and add allowed fields to service client
we were overwriting it before validating the form for POST, so lost info
2016-08-12 12:37:18 +01:00
Chris Hill-Scott
955566b127 Don’t allow changing service users on update 2016-08-11 17:10:10 +01:00
Chris Hill-Scott
da1fa2e61c Make _attach_current_user a pure function
Mutating dictionaries is gross and doesn’t work as you’d expect. Better
to have the function return a new dictionary instead.

Means we can be explicit that `created_by` is one of the allowed params
when updating a service.
2016-08-11 17:07:55 +01:00
Chris Hill-Scott
0cfe10639a Only allow update service to modify named attrs
To prevent typos and inadvertently updating something we shouldn’t,
this adds some filtering to the update_service method to make sure it
is only allowed to update certain attributes of a service.
2016-08-11 17:07:43 +01:00
Chris Hill-Scott
002b58a062 Make service API client do partial updates
The service API client was updating every attribute of a service. Which,
while kinda clunky, is fine…

…until something calling it doesn’t pass in every attribute of the
current service. It was then defaulting optional parameters to `None`.
Which resulted in a bug whereby every time a service was set to live,
its `reply_to_address` and `sms_sender_name` got overwritten to be
empty.

This commit changes the `update` method to only require the service ID,
and pass whatever other named arguments it received straight through to
the API. The API handles partial updates just fine (I think).
2016-08-11 17:07:33 +01:00
Leo Hemsted
3f3463b1ff Merge branch 'master' into remove-stats-from-send 2016-08-09 14:41:00 +01:00
Leo Hemsted
4ea23a7484 move away from statistics_api towards service_api 2016-07-29 10:28:18 +01:00
Leo Hemsted
eaf9b6dc54 pass 'today_only' flag to the back-end from send page
also bump notification-utils requirement to 8.7.0 for changes
to RecipientCSV
2016-07-25 15:26:43 +01:00
Leo Hemsted
0accd88869 request stats for today from send page from GET /service/:id endpoint
also amended test cases to ensure they mock out correct call
2016-07-25 14:46:27 +01:00
Leo Hemsted
3ffd6c744c separate detailed and normal service_api_client.get_service
to make it easier to mock and control return values
2016-07-20 14:12:22 +01:00
Leo Hemsted
4451a8634d add detailed flag to GET service api client
returns current (past 7 days) notification stats as well as service info
2016-07-20 14:12:22 +01:00
Leo Hemsted
1cd2841c17 rename api_client to service_api_client 2016-07-15 15:23:23 +01:00