Commit Graph

25 Commits

Author SHA1 Message Date
Leo Hemsted
bf18b179b0 ensure the user_number in inbound sms is international
rather than using the `normalise_phone_number` function, use the
`validate_and_format_phone_number` function - this will also convert
all numbers to international format, which means we won't need to
worry about whether the user enters internaional or UK phone numbers
when searching
2017-06-02 15:20:18 +01:00
Leo Hemsted
ef52337d85 add inbound sms api
two endpoints:
* get all inbound sms for a service (you can limit to the X most
  recent, or filter by user's phone number [which will be normalised])
* get a summary of inbound sms for a service - returns the count of
  inbound sms in the database, and the date that the most recent was
  sent
2017-06-02 15:20:18 +01:00
Leo Hemsted
4a85818c34 add inbound sms table 2017-05-30 10:47:01 +01:00
Imdad Ahad
78c10b7d30 Search notification against normalised recipient with filter for status 2017-05-26 11:45:56 +01:00
Rebecca Law
f555c7a73b Refactor tests to use the create_notication in tests.app.db 2017-05-25 11:41:07 +01:00
Ken Tsang
e68c3900e8 Add restricted argument for service mock 2017-05-17 16:06:35 +01:00
Ken Tsang
54446d5f4d Add default permissions when creating a service 2017-05-17 14:18:12 +01:00
kentsanggds
c4964d8cf4 Merge pull request #956 from alphagov/add-service-permissions
Add service permissions DAO and refactor user service permission mock
2017-05-16 14:26:15 +01:00
Ken Tsang
733c16b2bb Update to strip down DAO and clarify tests 2017-05-16 12:33:27 +01:00
Ken Tsang
54d801979c Refactored to handle single service permission 2017-05-16 10:57:57 +01:00
Ken Tsang
114d4d84d4 Add service permissions DAO and refactor user service permission mock 2017-05-15 17:28:14 +01:00
Imdad Ahad
5eb02a45a5 Send go live email when service goes live 2017-05-12 14:07:06 +01:00
Imdad Ahad
048861b968 Add dao to get active users for service 2017-05-11 15:39:15 +01:00
Rebecca Law
1a64509186 Change the resultset from the yearly and monthly billing data queries.
Fix some formatting of the return objects.
2017-04-28 10:10:49 +01:00
Martyn Inglis
cdd3ad687c updated the fixture 2017-04-27 12:14:31 +01:00
Leo Hemsted
935e566284 add tests for letters not getting excluded 2017-04-19 14:22:25 +01:00
Ken Tsang
06ec7a59a6 Refactored code to personalise subject 2017-04-11 16:19:43 +01:00
Rebecca Law
140179b4b6 Create new task to build dvla file.
This will transform each notification in a job to a row in a file.
The file is then uploaded to S3.
The files will later be aggregated by the notifications-ftp app to send to dvla.

The method to upload the file to S3 should be pulled into notifications-utils package.
It is the same method used in notifications-admin.
2017-03-15 15:26:58 +00:00
Imdad Ahad
a4dc614ef7 Restore dao_create_template and use custom template fixture instead 2017-03-08 13:03:44 +00:00
Imdad Ahad
17b6c13c46 Small updates:
* Make config use new provider sms template id
* create_notification to account for created status
* Small robustness addition to test
2017-02-27 13:16:48 +00:00
Imdad Ahad
eafe8269ef Simplify dao method and update tests and fixtures 2017-02-24 13:39:58 +00:00
Leo Hemsted
c30b4d00e7 bump utils to 13.6.0 - downgrade non-gsm chars on sms send
also refactor test_send_to_providers to use the shiny new db.py
create_*db obj* functions and clean up some of the fixture usage
2017-02-17 11:26:43 +00:00
Leo Hemsted
4f238d241a persist_letter saves address correctly to database
the `to` field stores either the phone number or the email address
of the recipient - it's a bit more complicated for letters, since
there are address lines 1 through 6, and a postcode. In utils, they're
stored alongside the personalisation, and we have to ensure that when
we persist to the database we keep as much parity with utils to make
our work easier. Aside from sending, the `to` field is also used to
show recipients on the front end report pages - we've decided that the
best thing to store here is address_line_1 - which is probably going to
be either a person's name, company name, or PO box number

Also, a lot of tests and test cleanup - I added create_template and
create_notification functions in db.py, so if you're creating new
fixtures you can use these functions, and you won't need to pass
notify_db and notify_db_session around, huzzah!

also removed create param from sample_notification since it's not used
anywhere
2017-01-24 12:32:20 +00:00
Leo Hemsted
0f327a0995 remove pytest.mark.usefixtures decorator
while it's nice to use the decorator to signify fixtures with side
effects, it has unfortunate problems of completely overriding any
fixtures you've declared in the funcargs - so isn't really suitable
for our usecase where we often have other fixtures we rely on to
return values to us.

So for consistency, let's remove this and stick to using funcargs
to define our fixtures
2017-01-10 15:04:28 +00:00
Leo Hemsted
aeb79a0de9 refactor sample_user to create a new create_user function
this create_user function can be imported for use in creating specific
users in your tests, for example

```
from tests.app.db import create_user
def test_create_user_persists_to_database(notify_db_session):
    user = create_user()
    assert User.query.count() == 1
```

this has the benefit of not requiring you to pass the notify_db and
notify_db_session fixtures around, and separating custom object
creation from the fixture dependency trees to aid clarity

I started with sample_user since it has no downstream dependencies, but
the intention is to push this out to all db fixtures eventually. This
is a total conversion, but can be rolled out in a non-breaking manner
by keeping arguments in the fixture, and passing them through to the
new db function - then tests can be updated to use the create_* instead
of sample_* functions as and when you want to
2017-01-10 15:04:28 +00:00