Esempio n. 1
0
class TestLayer(unittest.TestCase):

    def setUp(self):
        self.model = Model({
            'operations': {
                'test_call': {
                    'input': {'shape': 'TestShape'}
                }
            },
            'shapes': {
                'String': {
                    'type': 'string',
                },
                'TestShape': {
                    'type': 'structure',
                    'members': [{
                        'name': 'foo',
                        'shape': 'String',
                        'required': True,
                    }]
                }
            }
        })

    def test_validate_before_call(self):
        v = Validation()
        self.assertRaises(
            ParameterError,
            v.before_call,
            None,
            self.model.get_operation("test_call"),
            foo=55,
        )
Esempio n. 2
0
class TestOperation(unittest.TestCase):

    def setUp(self):
        self.model = Model({
            'metadata': {},
            'shapes': {},
            'operations': {
                'dummy_operation': {
                    'http': {
                        'method': 'post',
                        'uri': '/foo',
                    },
                    'input': {'shape': 'dummy_operation_request'},
                    'output': {'shape': 'dummy_operation_response'},
                    'exceptions': {},
                    'documentation': 'Test method documentation',
                }
            },
        })

    def test_get_operation(self):
        operation = self.model.get_operation('dummy_operation')
        self.assertEqual(operation.name, "dummy_operation")