Skip to content

Commit a446f37

Browse files
authored
Reorganize tests to easy readability and further development (#199)
* reorganize keyring tests to match #100 and keyring namespace to simplify names * change aws_encryption_sdk.keyring to aws_encryption_sdk.keyrings for consistency in namespace names * autoformat * disable pylint similarity checks on imports Because we provide multiple implementations of certain types of things (keyrings, etc), this was triggering pylint due to them all needing to import the same types in order to function. * reorganize functional and integration tests * define structure for unit tests reorg * reorganize unit tests * rename test_values to vectors to avoid it being confused for a test file * remove aws_encryption_sdk from functional test namespace * remove aws_encryption_sdk from integration test namespace * remove aws_encryption_sdk from unit test namespace * rename test_crypto to vectors to avoid confusion * autoformat
1 parent 2d4b2c4 commit a446f37

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+227
-30
lines changed

test/functional/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"). You
44
# may not use this file except in compliance with the License. A copy of
@@ -10,3 +10,4 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13+
"""Dummy stub to make linters work better."""

test/functional/internal/__init__.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
"""Dummy stub to make linters work better."""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
"""Dummy stub to make linters work better."""

test/integration/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"). You
44
# may not use this file except in compliance with the License. A copy of
@@ -10,3 +10,4 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13+
"""Dummy stub to make linters work better."""

test/unit/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"). You
44
# may not use this file except in compliance with the License. A copy of
@@ -10,3 +10,4 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13+
"""Dummy stub to make linters work better."""

test/unit/caches/__init__.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
"""Dummy stub to make linters work better."""
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

test/unit/internal/__init__.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
"""Dummy stub to make linters work better."""

test/unit/internal/crypto/__init__.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
"""Dummy stub to make linters work better."""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
"""Dummy stub to make linters work better."""

test/unit/test_crypto_authentication_signer.py renamed to test/unit/internal/crypto/authentication/test_signer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from aws_encryption_sdk.internal.crypto.authentication import Signer
2020
from aws_encryption_sdk.internal.defaults import ALGORITHM
2121

22-
from .test_crypto import VALUES
22+
from ..vectors import VALUES
2323

2424
pytestmark = [pytest.mark.unit, pytest.mark.local]
2525

test/unit/test_crypto_authentication_verifier.py renamed to test/unit/internal/crypto/authentication/test_verifier.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from aws_encryption_sdk.internal.crypto.authentication import Verifier
2020
from aws_encryption_sdk.internal.defaults import ALGORITHM
2121

22-
from .test_crypto import VALUES
22+
from ..vectors import VALUES
2323

2424
pytestmark = [pytest.mark.unit, pytest.mark.local]
2525

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
"""Dummy stub to make linters work better."""

test/unit/test_crypto_elliptic_curve.py renamed to test/unit/internal/crypto/test_elliptic_curve.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from cryptography.hazmat.primitives.asymmetric import ec
1818
from cryptography.utils import InterfaceNotImplemented
1919
from mock import MagicMock, sentinel
20-
from pytest_mock import mocker # noqa pylint: disable=unused-import
2120

2221
import aws_encryption_sdk.internal.crypto.elliptic_curve
2322
from aws_encryption_sdk.exceptions import NotSupportedError
@@ -31,7 +30,7 @@
3130
generate_ecc_signing_key,
3231
)
3332

34-
from .test_crypto import VALUES
33+
from .vectors import VALUES
3534

3635
pytestmark = [pytest.mark.unit, pytest.mark.local]
3736

test/unit/test_crypto_wrapping_keys.py renamed to test/unit/internal/crypto/test_wrapping_keys.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from aws_encryption_sdk.internal.crypto.wrapping_keys import WrappingKey
2222
from aws_encryption_sdk.internal.structures import EncryptedData
2323

24-
from .test_crypto import VALUES
24+
from .vectors import VALUES
2525

2626
pytestmark = [pytest.mark.unit, pytest.mark.local]
2727

File renamed without changes.
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
"""Dummy stub to make linters work better."""

test/unit/test_deserialize.py renamed to test/unit/internal/formatting/test_deserialize.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from aws_encryption_sdk.identifiers import AlgorithmSuite
2424
from aws_encryption_sdk.internal.structures import EncryptedData
2525

26-
from .test_values import VALUES
26+
from ...vectors import VALUES
2727

2828
pytestmark = [pytest.mark.unit, pytest.mark.local]
2929

test/unit/test_encryption_context.py renamed to test/unit/internal/formatting/test_encryption_context.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from aws_encryption_sdk.exceptions import SerializationError
1919
from aws_encryption_sdk.identifiers import ContentAADString
2020

21-
from .test_values import VALUES
21+
from ...vectors import VALUES
2222

2323
pytestmark = [pytest.mark.unit, pytest.mark.local]
2424

test/unit/test_serialize.py renamed to test/unit/internal/formatting/test_serialize.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from aws_encryption_sdk.internal.structures import EncryptedData
2222
from aws_encryption_sdk.structures import EncryptedDataKey, MasterKeyInfo
2323

24-
from .test_values import VALUES
24+
from ...vectors import VALUES
2525

2626
pytestmark = [pytest.mark.unit, pytest.mark.local]
2727

File renamed without changes.

test/unit/test_internal_structures.py renamed to test/unit/internal/test_structures.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
MessageNoFrameBody,
2222
)
2323

24-
from .unit_test_utils import all_invalid_kwargs, all_valid_kwargs
24+
from ..unit_test_utils import all_invalid_kwargs, all_valid_kwargs
2525

2626
pytestmark = [pytest.mark.unit, pytest.mark.local]
2727

test/unit/internal/utils/__init__.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
"""Dummy stub to make linters work better."""

test/unit/test_util_streams.py renamed to test/unit/internal/utils/test_streams.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from aws_encryption_sdk.internal.str_ops import to_bytes, to_str
2020
from aws_encryption_sdk.internal.utils.streams import InsistentReaderBytesIO, ROStream, TeeStream
2121

22-
from .unit_test_utils import ExactlyTwoReads, NothingButRead, SometimesIncompleteReaderIO
22+
from ...unit_test_utils import ExactlyTwoReads, NothingButRead, SometimesIncompleteReaderIO
2323

2424
pytestmark = [pytest.mark.unit, pytest.mark.local]
2525

test/unit/test_utils.py renamed to test/unit/internal/utils/test_utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
from aws_encryption_sdk.keyrings.base import EncryptedDataKey
2525
from aws_encryption_sdk.structures import DataKey, MasterKeyInfo, RawDataKey
2626

27-
from .test_values import VALUES
28-
from .unit_test_utils import assert_prepped_stream_identity
27+
from ...unit_test_utils import assert_prepped_stream_identity
28+
from ...vectors import VALUES
2929

3030
pytestmark = [pytest.mark.unit, pytest.mark.local]
3131

test/unit/key_providers/__init__.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
"""Dummy stub to make linters work better."""
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
"""Dummy stub to make linters work better."""

test/unit/test_providers_base_master_key.py renamed to test/unit/key_providers/base/test_base_master_key.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from aws_encryption_sdk.key_providers.base import MasterKey, MasterKeyConfig, MasterKeyProvider
2121
from aws_encryption_sdk.structures import MasterKeyInfo
2222

23-
from .test_values import VALUES
23+
from ...vectors import VALUES
2424

2525
pytestmark = [pytest.mark.unit, pytest.mark.local]
2626

test/unit/test_providers_base_master_key_config.py renamed to test/unit/key_providers/base/test_base_master_key_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from aws_encryption_sdk.key_providers.base import MasterKeyConfig
1717

18-
from .unit_test_utils import all_invalid_kwargs, all_valid_kwargs
18+
from ...unit_test_utils import all_invalid_kwargs, all_valid_kwargs
1919

2020
pytestmark = [pytest.mark.unit, pytest.mark.local]
2121

test/unit/test_providers_base_master_key_provider.py renamed to test/unit/key_providers/base/test_base_master_key_provider.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
)
2424
from aws_encryption_sdk.key_providers.base import MasterKeyProvider, MasterKeyProviderConfig
2525

26-
from .test_values import VALUES
26+
from ...vectors import VALUES
2727

2828
pytestmark = [pytest.mark.unit, pytest.mark.local]
2929

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
"""Dummy stub to make linters work better."""

test/unit/test_providers_kms_master_key.py renamed to test/unit/key_providers/kms/test_kms_master_key.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from aws_encryption_sdk.key_providers.kms import KMSMasterKey, KMSMasterKeyConfig
2323
from aws_encryption_sdk.structures import DataKey, EncryptedDataKey, MasterKeyInfo
2424

25-
from .test_values import VALUES
25+
from ...vectors import VALUES
2626

2727
pytestmark = [pytest.mark.unit, pytest.mark.local]
2828

test/unit/test_providers_kms_master_key_config.py renamed to test/unit/key_providers/kms/test_kms_master_key_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from aws_encryption_sdk.key_providers.base import MasterKeyConfig
1818
from aws_encryption_sdk.key_providers.kms import _PROVIDER_ID, KMSMasterKeyConfig
1919

20-
from .unit_test_utils import all_invalid_kwargs, all_valid_kwargs
20+
from ...unit_test_utils import all_invalid_kwargs, all_valid_kwargs
2121

2222
pytestmark = [pytest.mark.unit, pytest.mark.local]
2323

test/unit/test_providers_kms_master_key_provider_config.py renamed to test/unit/key_providers/kms/test_kms_master_key_provider_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from aws_encryption_sdk.key_providers.base import MasterKeyProviderConfig
1818
from aws_encryption_sdk.key_providers.kms import KMSMasterKeyProviderConfig
1919

20-
from .unit_test_utils import all_invalid_kwargs, all_valid_kwargs
20+
from ...unit_test_utils import all_invalid_kwargs, all_valid_kwargs
2121

2222
pytestmark = [pytest.mark.unit, pytest.mark.local]
2323

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
"""Dummy stub to make linters work better."""

test/unit/test_providers_raw_master_key.py renamed to test/unit/key_providers/raw/test_raw_master_key.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from aws_encryption_sdk.key_providers.raw import RawMasterKey, RawMasterKeyConfig
2121
from aws_encryption_sdk.structures import DataKey, EncryptedDataKey, MasterKeyInfo, RawDataKey
2222

23-
from .test_values import VALUES
23+
from ...vectors import VALUES
2424

2525
pytestmark = [pytest.mark.unit, pytest.mark.local]
2626

test/unit/test_providers_raw_master_key_config.py renamed to test/unit/key_providers/raw/test_raw_master_key_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from aws_encryption_sdk.key_providers.base import MasterKeyConfig
2020
from aws_encryption_sdk.key_providers.raw import RawMasterKeyConfig
2121

22-
from .unit_test_utils import all_invalid_kwargs, all_valid_kwargs
22+
from ...unit_test_utils import all_invalid_kwargs, all_valid_kwargs
2323

2424
pytestmark = [pytest.mark.unit, pytest.mark.local]
2525

test/unit/test_providers_raw_master_key_provider.py renamed to test/unit/key_providers/raw/test_raw_master_key_provider.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from aws_encryption_sdk.key_providers.base import MasterKeyProvider, MasterKeyProviderConfig
1919
from aws_encryption_sdk.key_providers.raw import RawMasterKeyProvider
2020

21-
from .test_values import VALUES
21+
from ...vectors import VALUES
2222

2323
pytestmark = [pytest.mark.unit, pytest.mark.local]
2424

0 commit comments

Comments
 (0)