Skip to content

Instantly share code, notes, and snippets.

@DBC-Works
Created October 1, 2023 07:03
Show Gist options
  • Save DBC-Works/04804063f46acece3eaea368be2456f0 to your computer and use it in GitHub Desktop.
Save DBC-Works/04804063f46acece3eaea368be2456f0 to your computer and use it in GitHub Desktop.
Test class template using moto
import boto3
from moto import mock_s3
import pytest
class TestClassTemplateUsingMoto:
@classmethod
def setup_class(cls):
cls.__mock_s3 = mock_s3()
cls.__mock_s3.start()
s3_resource = boto3.resource("s3")
s3_resource.create_bucket(Bucket="test-bucket")
@classmethod
def teardown_class(cls):
cls.__mock_s3.stop()
def test_with_s3_mock(self):
# arrange
# act
# assert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment