def test_consumes_with_valid_value(msg_assertions): try: operation_validator({'consumes': ['application/json']}) except ValidationError as err: errors = err.detail else: errors = {} msg_assertions.assert_path_not_in_errors('consumes', errors)
def test_consumes_is_not_required(msg_assertions): try: operation_validator({}) except ValidationError as err: errors = err.detail else: errors = {} msg_assertions.assert_path_not_in_errors('consumes', errors)
def test_external_docs_with_valid_value(msg_assertions): try: operation_validator({'consumes': {'url': 'http://example.com'}}) except ValidationError as err: errors = err.detail else: errors = {} msg_assertions.assert_path_not_in_errors('externalDocs', errors)
def test_consumes_type_validation(value, MESSAGES, msg_assertions): with pytest.raises(ValidationError) as err: operation_validator({'consumes': value}) msg_assertions.assert_message_in_errors( MESSAGES['type']['invalid'], err.value.detail, 'consumes.type', )
def test_consumes_type_validation(value, MESSAGES, msg_assertions): with pytest.raises(ValidationError) as err: operation_validator({'consumes': value}) msg_assertions.assert_message_in_errors( MESSAGES['type']['invalid'], err.value.detail, 'consumes.type', )
def test_consumes_with_valid_value(msg_assertions): try: operation_validator({'consumes': ['application/json']}) except ValidationError as err: errors = err.detail else: errors = {} msg_assertions.assert_path_not_in_errors('consumes', errors)
def test_responses_with_valid_value(msg_assertions): try: operation_validator({'responses': {}}) except ValidationError as err: errors = err.detail else: errors = {} msg_assertions.assert_path_not_in_errors('responses', errors)
def test_consumes_is_not_required(msg_assertions): try: operation_validator({}) except ValidationError as err: errors = err.detail else: errors = {} msg_assertions.assert_path_not_in_errors('consumes', errors)
def test_parameters_with_valid_value(msg_assertions): try: operation_validator({'parameters': []}) except ValidationError as err: errors = err.detail else: errors = {} msg_assertions.assert_path_not_in_errors('parameters', errors)
def test_parameters_with_valid_value(msg_assertions): try: operation_validator({'parameters': []}) except ValidationError as err: errors = err.detail else: errors = {} msg_assertions.assert_path_not_in_errors('parameters', errors)
def test_responses_with_valid_value(msg_assertions): try: operation_validator({'responses': {}}) except ValidationError as err: errors = err.detail else: errors = {} msg_assertions.assert_path_not_in_errors('responses', errors)
def test_tags_with_valid_value(msg_assertions): try: operation_validator({'tags': ['abc', 'def']}) except ValidationError as err: errors = err.detail else: errors = {} msg_assertions.assert_path_not_in_errors('tags', errors)
def test_external_docs_with_valid_value(msg_assertions): try: operation_validator({'consumes': {'url': 'http://example.com'}}) except ValidationError as err: errors = err.detail else: errors = {} msg_assertions.assert_path_not_in_errors('externalDocs', errors)