Use new API endpoint to get single contact list

When we first built the contact list feature this endpoint didn’t exist.
Now it does we can remove the slightly cludgy looping-through-all-the-lists
code.
This commit is contained in:
Chris Hill-Scott
2020-03-17 11:30:27 +00:00
parent cb555a4cbe
commit 82634f79de
5 changed files with 42 additions and 10 deletions

View File

@@ -1869,6 +1869,36 @@ def mock_get_contact_lists(mocker, api_user_active, fake_uuid):
)
@pytest.fixture(scope='function')
def mock_get_contact_list(mocker, api_user_active, fake_uuid):
def _get(*, service_id, contact_list_id):
return {
'created_at': '2020-03-13 10:59:56',
'created_by': 'Test User',
'id': fake_uuid,
'original_file_name': 'EmergencyContactList.xls',
'row_count': 100,
'service_id': service_id,
'template_type': 'email',
}
return mocker.patch(
'app.models.contact_list.contact_list_api_client.get_contact_list',
side_effect=_get,
)
@pytest.fixture(scope='function')
def mock_get_no_contact_list(mocker, api_user_active, fake_uuid):
def _get(*, service_id, contact_list_id):
raise HTTPError(response=Mock(status_code=404))
return mocker.patch(
'app.models.contact_list.contact_list_api_client.get_contact_list',
side_effect=_get,
)
@pytest.fixture(scope='function')
def mock_get_no_contact_lists(mocker):
return mocker.patch(