Add the yearly free limit to the service model.

This allows us to reference it across the API code base and return it in the API.

But not currently attached to the service DB model - a static method on the class.
This commit is contained in:
Martyn Inglis
2017-06-06 14:49:05 +01:00
parent 18dcc10a06
commit 75bf693f44
4 changed files with 22 additions and 2 deletions

View File

@@ -147,6 +147,17 @@ def test_get_service_by_id(client, sample_service):
assert json_resp['data']['sms_sender'] == current_app.config['FROM_NUMBER']
def test_get_service_by_id_returns_free_sms_limit(client, sample_service):
auth_header = create_authorization_header()
resp = client.get(
'/service/{}'.format(sample_service.id),
headers=[auth_header]
)
assert resp.status_code == 200
json_resp = json.loads(resp.get_data(as_text=True))
assert json_resp['data']['free_sms_fragment_limit'] == 250000
def test_get_service_list_has_default_permissions(client, service_factory):
service_factory.get('one')
service_factory.get('two')