mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-19 14:08:47 -04:00
Remove endpoints for checking name uniqueness
The code which called these endpoints was removed: - for services in https://github.com/alphagov/notifications-admin/pull/4084/files - for organisations in https://github.com/alphagov/notifications-admin/pull/4128/files Therefore these endpoints are no longer needed.
This commit is contained in:
@@ -2700,99 +2700,6 @@ def test_search_for_notification_by_to_field_returns_notifications_by_type(
|
||||
assert notifications[0]['id'] == str(sms_notification.id)
|
||||
|
||||
|
||||
def test_is_service_name_unique_returns_200_if_unique(admin_request, notify_db, notify_db_session):
|
||||
service = create_service(service_name='unique', email_from='unique')
|
||||
|
||||
response = admin_request.get(
|
||||
'service.is_service_name_unique',
|
||||
_expected_status=200,
|
||||
service_id=service.id,
|
||||
name='something',
|
||||
email_from='something'
|
||||
)
|
||||
|
||||
assert response == {"result": True}
|
||||
|
||||
|
||||
@pytest.mark.parametrize('name, email_from',
|
||||
[("UNIQUE", "unique"),
|
||||
("Unique.", "unique"),
|
||||
("**uniQUE**", "unique")
|
||||
])
|
||||
def test_is_service_name_unique_returns_200_with_name_capitalized_or_punctuation_added(
|
||||
admin_request,
|
||||
notify_db,
|
||||
notify_db_session,
|
||||
name,
|
||||
email_from
|
||||
):
|
||||
service = create_service(service_name='unique', email_from='unique')
|
||||
|
||||
response = admin_request.get(
|
||||
'service.is_service_name_unique',
|
||||
_expected_status=200,
|
||||
service_id=service.id,
|
||||
name=name,
|
||||
email_from=email_from
|
||||
)
|
||||
|
||||
assert response == {"result": True}
|
||||
|
||||
|
||||
@pytest.mark.parametrize('name, email_from', [
|
||||
("existing name", "email.from"),
|
||||
("name", "existing.name")
|
||||
])
|
||||
def test_is_service_name_unique_returns_200_and_false_if_name_or_email_from_exist_for_a_different_service(
|
||||
admin_request,
|
||||
notify_db,
|
||||
notify_db_session,
|
||||
name,
|
||||
email_from
|
||||
):
|
||||
create_service(service_name='existing name', email_from='existing.name')
|
||||
different_service_id = '111aa111-2222-bbbb-aaaa-111111111111'
|
||||
|
||||
response = admin_request.get(
|
||||
'service.is_service_name_unique',
|
||||
_expected_status=200,
|
||||
service_id=different_service_id,
|
||||
name=name,
|
||||
email_from=email_from
|
||||
)
|
||||
|
||||
assert response == {"result": False}
|
||||
|
||||
|
||||
def test_is_service_name_unique_returns_200_and_false_if_name_exists_for_the_same_service(
|
||||
admin_request,
|
||||
notify_db,
|
||||
notify_db_session
|
||||
):
|
||||
service = create_service(service_name='unique', email_from='unique')
|
||||
|
||||
response = admin_request.get(
|
||||
'service.is_service_name_unique',
|
||||
_expected_status=200,
|
||||
service_id=service.id,
|
||||
name='unique',
|
||||
email_from='unique2'
|
||||
)
|
||||
|
||||
assert response == {"result": False}
|
||||
|
||||
|
||||
def test_is_service_name_unique_returns_400_when_name_does_not_exist(admin_request):
|
||||
response = admin_request.get(
|
||||
'service.is_service_name_unique',
|
||||
_expected_status=400
|
||||
)
|
||||
|
||||
assert response["message"][0]["service_id"] == ["Can't be empty"]
|
||||
assert response["message"][1]["name"] == ["Can't be empty"]
|
||||
assert response["message"][2]["email_from"] == ["Can't be empty"]
|
||||
|
||||
|
||||
def test_get_email_reply_to_addresses_when_there_are_no_reply_to_email_addresses(client, sample_service):
|
||||
response = client.get('/service/{}/email-reply-to'.format(sample_service.id),
|
||||
headers=[create_admin_authorization_header()])
|
||||
|
||||
Reference in New Issue
Block a user