Skip to content

Commit bf9f402

Browse files
authored
#1748 Remove the update_service_inbound_api_schema and associated tests. (#2225)
1 parent 05e4a98 commit bf9f402

File tree

2 files changed

+0
-54
lines changed

2 files changed

+0
-54
lines changed

app/service/service_callback_api_schema.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
11
from app.constants import NOTIFICATION_STATUS_TYPES_COMPLETED, CALLBACK_CHANNEL_TYPES, SERVICE_CALLBACK_TYPES
22
from app.schema_validation.definitions import uuid, https_url
33

4-
update_service_inbound_api_schema = {
5-
'$schema': 'http://json-schema.org/draft-04/schema#',
6-
'description': 'POST service callback/inbound api schema',
7-
'type': 'object',
8-
'title': 'Create service callback/inbound api',
9-
'properties': {
10-
'url': https_url,
11-
'bearer_token': {'type': 'string', 'minLength': 10},
12-
'notification_statuses': {'type': 'array', 'items': {'enum': NOTIFICATION_STATUS_TYPES_COMPLETED}},
13-
'updated_by_id': uuid,
14-
},
15-
'required': ['updated_by_id'],
16-
}
17-
184
create_service_callback_api_request_schema = {
195
'$schema': 'http://json-schema.org/draft-04/schema#',
206
'description': 'POST service callback/inbound api schema',

tests/app/service/test_schema.py

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -9,50 +9,10 @@
99
from app.service.service_callback_api_schema import (
1010
create_service_callback_api_request_schema,
1111
update_service_callback_api_request_schema,
12-
update_service_inbound_api_schema,
1312
)
1413
from app.service.service_senders_schema import update_service_sms_sender_request
1514

1615

17-
def test_service_inbound_api_schema_validates(client):
18-
under_test = {
19-
'url': 'https://some_url.for_service',
20-
'bearer_token': 'something_ten_chars',
21-
'updated_by_id': str(uuid.uuid4()),
22-
}
23-
24-
assert validate(under_test, update_service_inbound_api_schema) == under_test
25-
26-
27-
@pytest.mark.parametrize('url', ['not a url', 'https not a url', 'http://valid.com'])
28-
def test_service_inbound_api_schema_errors_for_url_not_valid_url(client, url):
29-
under_test = {
30-
'url': url,
31-
'bearer_token': 'something_ten_chars',
32-
'updated_by_id': str(uuid.uuid4()),
33-
}
34-
35-
with pytest.raises(ValidationError) as e:
36-
validate(under_test, update_service_inbound_api_schema)
37-
errors = json.loads(str(e.value)).get('errors')
38-
assert len(errors) == 1
39-
assert errors[0]['message'] == 'url is not a valid https url'
40-
41-
42-
def test_service_inbound_api_schema_bearer_token_under_ten_char(client):
43-
under_test = {
44-
'url': 'https://some_url.for_service',
45-
'bearer_token': 'shorty',
46-
'updated_by_id': str(uuid.uuid4()),
47-
}
48-
49-
with pytest.raises(ValidationError) as e:
50-
validate(under_test, update_service_inbound_api_schema)
51-
errors = json.loads(str(e.value)).get('errors')
52-
assert len(errors) == 1
53-
assert errors[0]['message'] == 'bearer_token shorty is too short'
54-
55-
5616
def test_create_service_callback_api_schema_validate_succeeds(client):
5717
under_test = {
5818
'url': 'https://some_url.for_service',

0 commit comments

Comments
 (0)