diff --git a/test/integration/test_serialization.py b/test/integration/test_serialization.py index 1ada0689..cd89e71b 100644 --- a/test/integration/test_serialization.py +++ b/test/integration/test_serialization.py @@ -7,7 +7,7 @@ from exasol.ds.sandbox.lib.asset_id import AssetId from exasol.ds.sandbox.lib.setup_ec2.cf_stack import CloudformationStack from exasol.ds.sandbox.lib.setup_ec2.key_file_manager import KeyFileManager -from test.aws_local_stack_access import AwsLocalStackAccess +from test.aws.local_stack_access import AwsLocalStackAccess import multiprocessing as mp diff --git a/test/unit/aws/test_make_ami_public.py b/test/unit/aws/test_make_ami_public.py index e5e1c359..72f65ea8 100644 --- a/test/unit/aws/test_make_ami_public.py +++ b/test/unit/aws/test_make_ami_public.py @@ -7,8 +7,9 @@ from exasol.ds.sandbox.lib.aws_access.ami import Ami from exasol.ds.sandbox.lib.aws_access.aws_access import AwsAccess from exasol.ds.sandbox.lib.export_vm.run_make_ami_public import run_make_ami_public -from test.aws_mock_data import get_ami_image_mock_data +from test.aws.mock_data import get_ami_image_mock_data +from test.aws.fixtures import default_asset_id from test.mock_cast import mock_cast diff --git a/test/unit/test_make_ami_public.py b/test/unit/test_make_ami_public.py deleted file mode 100644 index ad8c4880..00000000 --- a/test/unit/test_make_ami_public.py +++ /dev/null @@ -1,52 +0,0 @@ -from copy import copy -from typing import Union -from unittest.mock import create_autospec, Mock - -import pytest - -from exasol.ds.sandbox.lib.aws_access.ami import Ami -from exasol.ds.sandbox.lib.aws_access.aws_access import AwsAccess -from exasol.ds.sandbox.lib.export_vm.run_make_ami_public import run_make_ami_public -from test.aws.mock_data import get_ami_image_mock_data - -from test.mock_cast import mock_cast - - -def test_make_ami_public(default_asset_id): - aws_access_mock: Union[AwsAccess, Mock] = create_autospec(AwsAccess, spec_set=True) - - mock_ami = get_ami_image_mock_data("AVAILABLE") - - mock_public_ami_data = copy(mock_ami._aws_object) - mock_public_ami_data["Public"] = True - mock_cast(aws_access_mock.list_amis).return_value = [mock_ami] - mock_cast(aws_access_mock.get_ami).return_value = Ami(mock_public_ami_data) - run_make_ami_public(aws_access_mock, default_asset_id) - mock_cast(aws_access_mock.modify_image_launch_permission).assert_called_once_with(mock_ami.id, { - 'Add': [ - { - 'Group': 'all', - }, - ], - }) - - -def test_make_ami_public_not_changing_public_ami(default_asset_id): - aws_access_mock: Union[AwsAccess, Mock] = create_autospec(AwsAccess, spec_set=True) - - mock_ami = get_ami_image_mock_data("AVAILABLE") - mock_ami._aws_object["Public"] = True - mock_cast(aws_access_mock.list_amis).return_value = [mock_ami] - run_make_ami_public(aws_access_mock, default_asset_id) - mock_cast(aws_access_mock.get_ami).assert_not_called() - mock_cast(aws_access_mock.modify_image_launch_permission).assert_not_called() - - -def test_make_ami_public_not_changed_raises_exception(default_asset_id): - aws_access_mock: Union[AwsAccess, Mock] = create_autospec(AwsAccess, spec_set=True) - - mock_ami = get_ami_image_mock_data("AVAILABLE") - mock_cast(aws_access_mock.list_amis).return_value = [mock_ami] - mock_cast(aws_access_mock.get_ami).return_value = mock_ami - with pytest.raises(RuntimeError, match=f"Making AMI {mock_ami.id} public did not work"): - run_make_ami_public(aws_access_mock, default_asset_id)