|
9 | 9 | from app.service.service_callback_api_schema import (
|
10 | 10 | create_service_callback_api_request_schema,
|
11 | 11 | update_service_callback_api_request_schema,
|
12 |
| - update_service_inbound_api_schema, |
13 | 12 | )
|
14 | 13 | from app.service.service_senders_schema import update_service_sms_sender_request
|
15 | 14 |
|
16 | 15 |
|
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 |
| - |
56 | 16 | def test_create_service_callback_api_schema_validate_succeeds(client):
|
57 | 17 | under_test = {
|
58 | 18 | 'url': 'https://some_url.for_service',
|
|
0 commit comments