Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove "attributes" from EncryptionContext str/repr #128

Merged
merged 4 commits into from
Oct 3, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
Changelog
*********

1.1.2 -- 2019-09-??
1.1.2 -- 2019-10-??
===================

Bugfixes
--------
* Fix :class:`AwsKmsCryptographicMaterialsProvider` regional clients override bug
`#124 <https://github.com/aws/aws-dynamodb-encryption-python/issues/124>`_
* Remove ``attributes`` attribute from :class:`EncryptionContext` ``str`` and ``repr`` values.
`#127 <https://github.com/aws/aws-dynamodb-encryption-python/issues/127>`_

1.1.1 -- 2019-08-29
===================
Expand Down
1 change: 1 addition & 0 deletions src/dynamodb_encryption_sdk/structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class EncryptionContext(object):
validator=attr.validators.optional(attr.validators.instance_of(six.string_types)), default=None
)
attributes = attr.ib(
repr=False,
validator=(dictionary_validator(six.string_types, dict), _validate_attribute_values_are_ddb_items),
default=attr.Factory(dict),
)
Expand Down
26 changes: 26 additions & 0 deletions test/unit/test_structures.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
"""Unit tests for ``dynamodb_encryption_sdk.structures``."""
import pytest

from dynamodb_encryption_sdk.structures import EncryptionContext


@pytest.mark.parametrize("operator", (repr, str))
def test_encryption_context_repr(operator):
value = EncryptionContext(attributes={"unique_name": {"S": "unique_value"}})

test = operator(value)

assert "unique_name" not in test
assert "unique_value" not in test