Skip to content

Commit

Permalink
fix moto imports
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonLuttenberger committed Jun 5, 2024
1 parent e821db8 commit c89f646
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 33 deletions.
4 changes: 2 additions & 2 deletions test/unit-test/test_cli_arg.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import mock_data.mock_manifests as mock_manifests
import pytest
from _test_cli_helper_functions import _test_command
from moto import mock_sts
from moto import mock_aws

from seedfarmer import config
from seedfarmer.__main__ import apply, bootstrap, destroy, init, metadata, projectpolicy, remove, store, version
Expand Down Expand Up @@ -75,7 +75,7 @@ def env_file2():

@pytest.fixture(scope="function")
def sts_client(aws_credentials):
with mock_sts():
with mock_aws():
yield boto3_client(service_name="sts", session=None)


Expand Down
4 changes: 2 additions & 2 deletions test/unit-test/test_commands_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import boto3
import pytest
from moto import mock_sts
from moto import mock_aws

import seedfarmer
import seedfarmer.commands._bootstrap_commands as bc
Expand All @@ -24,7 +24,7 @@ def aws_credentials():

@pytest.fixture(scope="function")
def sts_client(aws_credentials):
with mock_sts():
with mock_aws():
yield boto3_client(service_name="sts", session=None)


Expand Down
4 changes: 2 additions & 2 deletions test/unit-test/test_commands_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import mock_data.mock_manifests as mock_manifests
import mock_data.mock_module_info_huge as mock_module_info_huge
import pytest
from moto import mock_sts
from moto import mock_aws

import seedfarmer.commands._deployment_commands as dc
import seedfarmer.errors
Expand All @@ -34,7 +34,7 @@ def aws_credentials():

@pytest.fixture(scope="function")
def sts_client(aws_credentials):
with mock_sts():
with mock_aws():
yield boto3_client(service_name="sts", session=None)


Expand Down
4 changes: 2 additions & 2 deletions test/unit-test/test_commands_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import pytest
import yaml
from moto import mock_sts
from moto import mock_aws

import seedfarmer.commands._module_commands as mc
import seedfarmer.errors
Expand All @@ -27,7 +27,7 @@ def aws_credentials():

@pytest.fixture(scope="function")
def sts_client(aws_credentials):
with mock_sts():
with mock_aws():
yield boto3_client(service_name="sts", session=None)


Expand Down
4 changes: 2 additions & 2 deletions test/unit-test/test_commands_network_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Any, Dict, cast

import pytest
from moto import mock_sts
from moto import mock_aws

import seedfarmer.commands._network_parameter_commands as npc
import seedfarmer.errors
Expand All @@ -24,7 +24,7 @@ def aws_credentials():

@pytest.fixture(scope="function")
def sts_client(aws_credentials):
with mock_sts():
with mock_aws():
yield boto3_client(service_name="sts", session=None)


Expand Down
4 changes: 2 additions & 2 deletions test/unit-test/test_commands_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pydantic_core
import pytest
from moto import mock_sts
from moto import mock_aws

import seedfarmer.commands._parameter_commands as pc
import seedfarmer.errors
Expand All @@ -24,7 +24,7 @@ def aws_credentials():

@pytest.fixture(scope="function")
def sts_client(aws_credentials):
with mock_sts():
with mock_aws():
yield boto3_client(service_name="sts", session=None)


Expand Down
4 changes: 2 additions & 2 deletions test/unit-test/test_commands_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest
import yaml
from moto import mock_sts
from moto import mock_aws

import seedfarmer.commands._stack_commands as sc
from seedfarmer.models.manifests import DeploymentManifest
Expand All @@ -23,7 +23,7 @@ def aws_credentials():

@pytest.fixture(scope="function")
def sts_client(aws_credentials):
with mock_sts():
with mock_aws():
yield boto3_client(service_name="sts", session=None)


Expand Down
4 changes: 2 additions & 2 deletions test/unit-test/test_mgmt_build_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import mock_data.mock_build_info as mock_build_info
import pytest
from moto import mock_sts
from moto import mock_aws

import seedfarmer.mgmt.build_info as bi
from seedfarmer.services._service_utils import boto3_client
Expand All @@ -39,7 +39,7 @@ def aws_credentials():

@pytest.fixture(scope="function")
def sts_client(aws_credentials):
with mock_sts():
with mock_aws():
yield boto3_client(service_name="sts", session=None)


Expand Down
4 changes: 2 additions & 2 deletions test/unit-test/test_mgmt_deploy_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import mock_data.mock_manifests as mock_manifests
import mock_data.mock_module_info_huge as mock_module_info_huge
import pytest
from moto import mock_sts
from moto import mock_aws

import seedfarmer.errors
import seedfarmer.mgmt.deploy_utils as du
Expand All @@ -45,7 +45,7 @@ def aws_credentials():

@pytest.fixture(scope="function")
def sts_client(aws_credentials):
with mock_sts():
with mock_aws():
yield boto3_client(service_name="sts", session=None)


Expand Down
4 changes: 2 additions & 2 deletions test/unit-test/test_mgmt_git_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import os

import pytest
from moto import mock_sts
from moto import mock_aws

import seedfarmer.mgmt.git_support as sf_git
from seedfarmer.services._service_utils import boto3_client
Expand All @@ -38,7 +38,7 @@ def aws_credentials():

@pytest.fixture(scope="function")
def sts_client(aws_credentials):
with mock_sts():
with mock_aws():
yield boto3_client(service_name="sts", session=None)


Expand Down
22 changes: 11 additions & 11 deletions test/unit-test/test_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import boto3
import pytest
from moto import mock_codebuild, mock_iam, mock_ssm, mock_sts
from moto import mock_aws

from seedfarmer.services import _service_utils
from seedfarmer.services._service_utils import boto3_client
Expand All @@ -40,7 +40,7 @@ def session(aws_credentials):

@pytest.fixture(scope="function")
def sts_client(aws_credentials):
with mock_sts():
with mock_aws():
yield boto3_client(service_name="sts", session=None)


Expand All @@ -57,7 +57,7 @@ def session_manager(sts_client):

@pytest.fixture(scope="function")
def secretsmanager_client(aws_credentials, session_manager):
with mock_sts():
with mock_aws():
yield boto3_client(service_name="secretsmanager", session=None)


Expand Down Expand Up @@ -86,7 +86,7 @@ def test_utils_get_account_id(sts_client, mocker):

@pytest.fixture(scope="function")
def iam_client(aws_credentials):
with mock_iam():
with mock_aws():
yield _service_utils.boto3_client(service_name="iam", session=None)


Expand All @@ -95,7 +95,7 @@ def iam_client(aws_credentials):
def test_codebuild(session) -> None:
import seedfarmer.services._codebuild as codebuild

with mock_codebuild():
with mock_aws():
codebuild.get_build_data(build_ids=["codebuild:12345"], session=session)
codebuild.get_build_data(build_ids=["12345"], session=session)

Expand All @@ -105,7 +105,7 @@ def test_codebuild(session) -> None:
def test_iam(iam_client, session) -> None:
import seedfarmer.services._iam as iam

with mock_iam():
with mock_aws():
iam.create_check_iam_role(
project_name="test",
deployment_name="test",
Expand Down Expand Up @@ -160,7 +160,7 @@ def test_iam(iam_client, session) -> None:
def test_get_ssm_params(session) -> None:
import seedfarmer.services._ssm as ssm

with mock_ssm():
with mock_aws():
ssm.put_parameter(name="/myapp/test/", obj={"Hey": "tsting"}, session=session)
ssm.does_parameter_exist(name="/myapp/test/", session=session)
ssm.does_parameter_exist(name="/garbage/", session=session)
Expand All @@ -174,15 +174,15 @@ def test_get_ssm_params(session) -> None:
def test_put_ssm_param(session) -> None:
import seedfarmer.services._ssm as ssm

with mock_ssm():
with mock_aws():
ssm.put_parameter(name="/myapp/test/", obj={"Hey": "tsting"}, session=session)


@pytest.mark.service
def test_list_ssm_param(session) -> None:
import seedfarmer.services._ssm as ssm

with mock_ssm():
with mock_aws():
ssm.put_parameter(name="/myapp/test/", obj={"Hey": "testing"}, session=session)
ssm.list_parameters(prefix="/myapp/test/", session=session)
ssm.list_parameters_with_filter(prefix="/myapp/", contains_string="test", session=session)
Expand All @@ -192,7 +192,7 @@ def test_list_ssm_param(session) -> None:
def test_delete_ssm_param(session) -> None:
import seedfarmer.services._ssm as ssm

with mock_ssm():
with mock_aws():
ssm.delete_parameters(parameters=["/myapp", "/myapp/test/"], session=session)
ssm.delete_parameters(
parameters=[
Expand All @@ -215,7 +215,7 @@ def test_delete_ssm_param(session) -> None:
def test_get_ssm_metadata(session) -> None:
import seedfarmer.services._ssm as ssm

with mock_ssm():
with mock_aws():
ssm.put_parameter(name="/myapp/test/", obj={"Hey": "testing"}, session=session)
ssm.describe_parameter(name="/myapp/test/", session=session)

Expand Down
4 changes: 2 additions & 2 deletions test/unit-test/test_session_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import os

import pytest
from moto import mock_sts
from moto import mock_aws

import seedfarmer.errors
from seedfarmer.services._service_utils import boto3_client
Expand All @@ -40,7 +40,7 @@ def aws_credentials():

@pytest.fixture(scope="function")
def sts_client(aws_credentials):
with mock_sts():
with mock_aws():
yield boto3_client(service_name="sts", session=None)


Expand Down

0 comments on commit c89f646

Please sign in to comment.