Make provider tests agnostic to actual data

The provider tests are coupled to actual data in the DB, but we
shouldn't have to overhaul the tests when this changes.

Assuming we don't delete old providers, just testing a subset of
the fixture data should give us enough confidence in the code.
This commit is contained in:
Ben Thorner
2022-03-25 11:46:01 +00:00
parent 22e055f4d1
commit 84578e8a1d
2 changed files with 24 additions and 25 deletions

View File

@@ -10,8 +10,8 @@ from tests.app.db import create_ft_billing
def test_get_provider_details_returns_all_providers(admin_request, notify_db_session):
json_resp = admin_request.get('provider_details.get_providers')['provider_details']
assert len(json_resp) == 4
assert {x['identifier'] for x in json_resp} == {'ses', 'firetext', 'mmg', 'dvla'}
assert len(json_resp) > 0
assert {'ses', 'firetext', 'mmg', 'dvla'} < {x['identifier'] for x in json_resp}
def test_get_provider_details_by_id(client, notify_db):
@@ -45,7 +45,7 @@ def test_get_provider_contains_correct_fields(client, sample_template):
"active", "updated_at", "supports_international",
"current_month_billable_sms"
}
assert len(json_resp) == 4
assert len(json_resp) > 0
assert allowed_keys == set(json_resp[0].keys())