Commit Graph

12 Commits

Author SHA1 Message Date
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