import mock
from tests import BaseSessionTest
class TestMachineLearning(BaseSessionTest):
def setUp(self):
super(TestMachineLearning, self).setUp()
self.region = 'us-west-2'
self.client = self.session.create_client(
'machinelearning', self.region)
def test_predict(self):
with mock.patch('botocore.endpoint.Session.send') as \
http_session_send_patch:
http_response = mock.Mock()
http_response.status_code = 200
http_response.content = b'{}'
http_response.headers = {}
http_session_send_patch.return_value = http_response
custom_endpoint = 'https://myendpoint.amazonaws.com/'
self.client.predict(
MLModelId='ml-foo',
Record={'Foo': 'Bar'},
PredictEndpoint=custom_endpoint
)
sent_request = http_session_send_patch.call_args[0][0]
self.assertEqual(sent_request.url, custom_endpoint)