Created
May 29, 2019 01:25
-
-
Save GeneralTesler/a84880334ba13b7c2147e83d47cb391a to your computer and use it in GitHub Desktop.
Python3 - mocking AWS services for unittest-ing using moto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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