Skip to content

Commit

Permalink
#1748 Remove the update_service_inbound_api_schema and associated tes…
Browse files Browse the repository at this point in the history
…ts. (#2225)
  • Loading branch information
kalbfled authored Jan 6, 2025
1 parent 05e4a98 commit bf9f402
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 54 deletions.
14 changes: 0 additions & 14 deletions app/service/service_callback_api_schema.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
from app.constants import NOTIFICATION_STATUS_TYPES_COMPLETED, CALLBACK_CHANNEL_TYPES, SERVICE_CALLBACK_TYPES
from app.schema_validation.definitions import uuid, https_url

update_service_inbound_api_schema = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'description': 'POST service callback/inbound api schema',
'type': 'object',
'title': 'Create service callback/inbound api',
'properties': {
'url': https_url,
'bearer_token': {'type': 'string', 'minLength': 10},
'notification_statuses': {'type': 'array', 'items': {'enum': NOTIFICATION_STATUS_TYPES_COMPLETED}},
'updated_by_id': uuid,
},
'required': ['updated_by_id'],
}

create_service_callback_api_request_schema = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'description': 'POST service callback/inbound api schema',
Expand Down
40 changes: 0 additions & 40 deletions tests/app/service/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,50 +9,10 @@
from app.service.service_callback_api_schema import (
create_service_callback_api_request_schema,
update_service_callback_api_request_schema,
update_service_inbound_api_schema,
)
from app.service.service_senders_schema import update_service_sms_sender_request


def test_service_inbound_api_schema_validates(client):
under_test = {
'url': 'https://some_url.for_service',
'bearer_token': 'something_ten_chars',
'updated_by_id': str(uuid.uuid4()),
}

assert validate(under_test, update_service_inbound_api_schema) == under_test


@pytest.mark.parametrize('url', ['not a url', 'https not a url', 'http://valid.com'])
def test_service_inbound_api_schema_errors_for_url_not_valid_url(client, url):
under_test = {
'url': url,
'bearer_token': 'something_ten_chars',
'updated_by_id': str(uuid.uuid4()),
}

with pytest.raises(ValidationError) as e:
validate(under_test, update_service_inbound_api_schema)
errors = json.loads(str(e.value)).get('errors')
assert len(errors) == 1
assert errors[0]['message'] == 'url is not a valid https url'


def test_service_inbound_api_schema_bearer_token_under_ten_char(client):
under_test = {
'url': 'https://some_url.for_service',
'bearer_token': 'shorty',
'updated_by_id': str(uuid.uuid4()),
}

with pytest.raises(ValidationError) as e:
validate(under_test, update_service_inbound_api_schema)
errors = json.loads(str(e.value)).get('errors')
assert len(errors) == 1
assert errors[0]['message'] == 'bearer_token shorty is too short'


def test_create_service_callback_api_schema_validate_succeeds(client):
under_test = {
'url': 'https://some_url.for_service',
Expand Down

0 comments on commit bf9f402

Please sign in to comment.