-
Notifications
You must be signed in to change notification settings - Fork 6
/
conftest.py
35 lines (26 loc) · 954 Bytes
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""
Configuration for pytest fixtures
"""
import boto3 # type: ignore
import pytest # type: ignore
from chalice import Chalice # type: ignore
from moto import mock_ssm # type: ignore
@pytest.fixture
def app() -> Chalice:
"""Return the application for testing"""
from app import app as chalice_app # pylint: disable=import-outside-toplevel
return chalice_app
@pytest.fixture(autouse=True)
def mocked_aws_credentials(monkeypatch):
"""Mocked AWS Credentials for moto."""
monkeypatch.setenv("AWS_ACCESS_KEY_ID", "testing")
monkeypatch.setenv("AWS_SECRET_ACCESS_KEY", "testing")
monkeypatch.setenv("AWS_SECURITY_TOKEN", "testing")
monkeypatch.setenv("AWS_SESSION_TOKEN", "testing")
monkeypatch.setenv("AWS_DEFAULT_REGION", "eu-west-1")
boto3.setup_default_session()
@pytest.fixture(scope="function")
def ssm():
"""Mock for AWS Systems Manager"""
with mock_ssm():
yield boto3.client("ssm")