Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Python3 - mocking AWS services for unittest-ing using moto
from moto import mock_<service>
import boto3
import unittest
class TestFooBar(unittest.TestCase):
def __init__(self, *args, **kwargs):
super(TestFooBar, self).__init__(*args, **kwargs)
self.client = boto3.client("<service>")
self.mock = mock_<service>()
def setUp(self):
self.mock.start(reset=True)
# ...
def tearDown(self):
self.mock.stop()
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment