Commit Graph

269 Commits

Author SHA1 Message Date
Pea Tyczynska
f79c0b03e7 Sample job uses create_template instead of sample template 2019-01-03 10:52:14 +00:00
Pea Tyczynska
cde30de100 Use create_template instead of sample_template in sample_notification 2019-01-03 10:52:14 +00:00
Pea Tyczynska
154257027f Nothing in conftest uses sample_service now :) 2019-01-03 10:52:14 +00:00
Pea Tyczynska
d367daaf6e Some more conftest fixtures use create_service instead of sample_service 2019-01-03 10:52:14 +00:00
Pea Tyczynska
a3310c2da6 sample_job uses create_service instead of sample_service 2019-01-03 10:52:14 +00:00
Pea Tyczynska
0bcf13d85c sample_api_key uses create_service instead of sample_service 2019-01-03 10:52:14 +00:00
Pea Tyczynska
e8ce669b72 Use create_service instead of sample_service when creating sample_email_template for tests 2019-01-03 10:52:14 +00:00
Pea Tyczynska
95115e7ae6 Use create_service instead of sample_service when creating service permission for tests 2019-01-03 10:52:14 +00:00
Pea Tyczynska
923703120b Check if test service exists before it gets created 2019-01-03 10:52:14 +00:00
Pea Tyczynska
c12594949f Refactor service_factory 2019-01-03 10:49:38 +00:00
Pea Tyczynska
686c58acee Test post letter request sets notification postage correctly 2018-12-24 11:27:29 +00:00
Leo Hemsted
bf62d3ad5f infer template/service from job for notification/ft_noti_status in db.py 2018-12-12 12:59:55 +00:00
Pea Tyczynska
f941b8b146 Use archived flag to see if job needs deleting from s3 bucket 2018-11-28 14:38:59 +00:00
Leo Hemsted
3589f1dd63 remove some use of calling fixtures directly
also experiment with giving the fixtures a different name, so we can be
sure that they won't be called in functions. Open to change on this.
2018-10-17 16:38:46 +01:00
Katie Smith
6727f0e0f5 Update ft_billing DAO functions to use postage
* Updated the 'fetch_billing_data_for_day' DAO function to take postage into
account
* Updated the 'update_fact_billing' DAO function to insert postage for
new rows. When updating rows which are identical apart from the postage, the
original row will be kept. (This behaviour will change once postage is
added to the primary key - at this point, upserting will add a new row.)
* Also changed some fixtures / test set up functions to take postage
into account
2018-09-28 13:52:17 +01:00
Rebecca Law
1c0892888f Change the name of letter_class to postage, this will match the domain language used in the documentation.
Updated the tests to answer review comments.
2018-09-18 15:22:08 +01:00
Leo Hemsted
32415b3b14 add delete functions for inbound and callback api objects
Both service api tasks work fine if the object is unexpectedly deleted
halfway through - they both check to see if the api details are still
in the DB before trying to send the request.
2018-07-05 11:09:17 +01:00
Katie Smith
0d4fb81235 Delete ProviderStatistics model
This is not being used anywhere, so can be deleted safely.
2018-05-21 15:03:39 +01:00
venusbb
5d7d4a0dd6 Added test for reporting tasks 2018-03-14 17:07:52 +00:00
Rebecca Law
bffc4863db Remove all methods no longer used now that we only send pdf files to DVLA. 2018-03-02 11:05:05 +00:00
Rebecca Law
7faf375375 Merge pull request #1695 from alphagov/org-user-endpoints
Organisation user endpoints
2018-02-26 16:27:01 +00:00
Alexey Bezhan
984a5050db Don't return hidden templates in API service template responses
Brings back filtering hidden templates from the API responses.
2018-02-26 13:28:08 +00:00
Alexey Bezhan
9b3a9a55c4 Revert "Don't return hidden templates in API service template responses"
Filtering out hidden templates requires all existing templates to
have `hidden` flag set, which can only be done by a migration after
the code that sets the flag to `False` by default for new templates
has been released.

This removes the filtering logic until the migration has been released.
2018-02-26 11:44:25 +00:00
Alexey Bezhan
19dbe7da8d Don't return hidden templates in API service template responses
Removes hidden templates from the service templates list and returns
404 when searching for a hidden template or template versions by ID.
2018-02-23 17:52:25 +00:00
Alexey Bezhan
e659253b01 Set Notify service user as the creator of Pre-compiled PDF template 2018-02-23 17:52:24 +00:00
Leo Hemsted
57a174aeb4 add tests for org invite rest, and update conftest 2018-02-23 10:45:18 +00:00
Ken Tsang
60f96ab598 Organisation service DAO 2018-02-13 14:06:43 +00:00
Rebecca Law
c54e0d322b A little clean up 2017-12-28 10:58:15 +00:00
Ken Tsang
d0fcfa7d0c Update sample_service_full_perms to leave out letters_as_pdf permissions
- as letters_as_pdf is a temporary service permission until the build dvla file process is deprecated rather than update all the tests to remove the permission so that they pass, lets remove it here instead
2017-12-12 12:07:55 +00:00
Ken Tsang
bc316dd1fe Add reference as part of sample_letter_notification 2017-12-12 12:07:55 +00:00
Ken Tsang
16136317f9 Add letters pdf task 2017-12-12 12:07:55 +00:00
Leo Hemsted
4cdcc4e035 no longer add an annual billing entry creating a service
this is now handled by a separate call from the admin app
2017-12-06 14:45:44 +00:00
Leo Hemsted
b0d4044ff5 remove free_sms_fragment_limit from service
* remove from model
* still required when calling POST /service - we just call through
  from dao_create_service to add a new annual billing entry.
* removed from POST /service/<id> update_service - if you want to
  update/add a new one, use POST /service/<id>/free-sms-fragment-limit
* made sure tests create services with default 250k limit.
2017-12-06 14:45:43 +00:00
Rebecca Law
b0d88ec08c Updates as per review comments 2017-11-28 11:05:56 +00:00
Rebecca Law
530f2e7f6a Update invite user endpoint to set the reply_to_text on the notification.
Update v1 post notifications to set the reply_to_text on the notification.
2017-11-27 12:30:50 +00:00
Chris Hill-Scott
e8a94422e5 Make SMS prefix setting non-nullable
We have now:
- defaulted new services to start with this column set to `true`
- migrated all preexisting services[1] to have either `true` or `false` set
  for this column

There is no way for a service to switch back from `true`/`false` to
`null`.

This means that we can safely enforce a non-nullable constraint on this
column now.

1. There is a little gotcha: the GOV.UK Notify service still relies on
   the `sms_sender` column. It doesn’t have a row in the
   `service_sms_senders` table. This means the previous migration
   never changed this service’s value for `prefix_sms` from `null`. So
   this commit also changes its value to `False`, so that the rest of
   the migration, of the whole column, is possible.
2017-11-16 14:29:32 +00:00
Alexey Bezhan
db1c647873 Remove NotificationHistory.template relationship
Relationship attribute is not used by the application code, so we
can remove it without replacing it with a TemplateHistory one.

This also updates the foreign key constraint to refer to the composite
primary key for the TemplateHistory records.
2017-11-10 15:13:55 +00:00
Alexey Bezhan
c62f2a3f7c Update create_custom_template test helper to create history object
`create_custom_template` is not using `dao_create_template` since
it explicitly sets a template id. Notifications.template relationship
now refers to a TemplateHistory objects, so we need to make sure that
`create_custom_template` creates a matching TemplateHistory record
when it creates a Template.
2017-11-10 15:13:55 +00:00
Alexey Bezhan
94dae42902 Avoid assigning notification.template when creating test objects
`Notification.template` changed from being a Template relationship
to TemplateHistory. When a relationship attribute is being assigned,
SQLAlchemy checks that the assigned value type matches the relationship
type. Since most tests at the moment create a notification using a
Template instance this check fails.

Rewriting the tests to use TemplateHistory objects would require
changes to the majority of tests. Instead, when creating a notification
objects we assign the foreign key attributes directly. This skips the
SQLAlchemy type check, but we still get the constraint check on the
foreign keys, so a matching TemplateHistory object needs to exist in
the database.
2017-11-10 15:12:07 +00:00
kentsanggds
34aa8dfd01 Merge pull request #1373 from alphagov/ken-get-inbound_sms-api
Get inbound SMS API
2017-11-10 10:25:02 +00:00
Leo Hemsted
6af616eb83 add name to personalisation and urlencode next param
also add tests
2017-11-07 16:47:26 +00:00
Leo Hemsted
dd326ec1d3 add new template to config
and rename existing new user email verification template for clarity
2017-11-07 16:47:26 +00:00
Ken Tsang
85b8e24e17 Add V2 inbound_sms API
- had to update the serialization in the model so that the date time is appended with the UTC timezone
- test has been added to ensure that the schema will validate the response correctly
2017-11-07 13:29:40 +00:00
Rebecca Law
f5e79302cd Remove NotificationStatistics
NotificationStatistics was added as a spike but didn't work out as expected. This is finally removing all that unused code.
I'll drop the table in the next PR
2017-11-01 15:02:50 +00:00
Chris Hill-Scott
46d45d8595 Make international SMS on for new services
International SMS is a mature, documented feature now. There’s no reason
it shouldn’t be available to everyone. If it’s turned off by default
then we’re relying on people finding it in the settings page to know
that it exists (which we found in research the other week that users,
who would have benefitted from having international SMS, were failing to
do).

This also fixes the problem whereby users signing up for Notify with an
international phone number (eg those working abroad for the Foreign and
Commonwealth Office) couldn’t get through the tour because they weren’t
able to send themselves the example text message (see
https://www.pivotaltracker.com/story/show/150705515).
2017-10-19 11:43:27 +01:00
Venus Bailey
9b60d69931 Revert "Revert "[#151837054] Add new column free_sms_fragment_limit in the Services table"" 2017-10-16 16:24:34 +01:00
Venus Bailey
616a6f8ef8 Revert "[#151837054] Add new column free_sms_fragment_limit in the Services table" 2017-10-16 12:43:05 +01:00
venusbb
f95282a84d Add column, free_sms_fragment_limit, to services & services_history
- Created new column in both tables
- Modified model and Service schema
- Modifed existing test
2017-10-12 12:16:13 +01:00
Katie Smith
dede336b3b Update tests to not use letter contact block from services table
A few test updates were needed after rebasing onto master.
2017-10-03 13:35:09 +01:00
Imdad Ahad
cb37ba5f78 Update schema to return default letter contact for a service 2017-10-03 10:31:21 +01:00