I'm using moto to mock out aws services to write my test cases and supported use cases is fine:
@mock_sts
def test_check_aws_profile(self):
session = boto3.Session(profile_name='foo')
client = session.client('sts')
client.get_caller_identity().get('Account')
But there are a few services like es that isn't supported at all. How do I begin to mock this?
I've tried this alternative mocking approach for testing but not sure if there's a better approach
def test_with_some_domains(self, mocker):
mocked_boto = mocker.patch('mymodule.boto3')
mocked_session = mocked_boto.Session()
mocked_client.list_domain_names.return_value = ['foo-bar-baz']
mymodule.function_call()
mymodule.py
def function_call():
session = boto3.Session(profile_name=my_profile)
client = session.client('es', some_region)
domain_names = client.list_domain_names()