import mock
from botocore.stub import Stubber
from tests import BaseSessionTest
class TestApiGateway(BaseSessionTest):
def setUp(self):
super(TestApiGateway, self).setUp()
self.region = 'us-west-2'
self.client = self.session.create_client(
'apigateway', self.region)
self.stubber = Stubber(self.client)
def test_get_export(self):
params = {
'restApiId': 'foo',
'stageName': 'bar',
'exportType': 'swagger',
'accepts': 'application/yaml'
}
with mock.patch('botocore.endpoint.Session.send') as _send:
_send.return_value = mock.Mock(
status_code=200, headers={}, content=b'{}')
self.client.get_export(**params)
sent_request = _send.call_args[0][0]
self.assertEqual(sent_request.method, 'GET')
self.assertEqual(
sent_request.headers.get('Accept'), b'application/yaml')