Skip to content

Commit

Permalink
test: added a test to check if account key isn't shown
Browse files Browse the repository at this point in the history
Check if account key gets substituted by ...

Signed-Off By Artem Maslov [email protected]. By including this sign-off line I agree to the terms of the Contributor License Agreement
  • Loading branch information
Artem Maslov committed Apr 11, 2024
1 parent 815f368 commit 283e31c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 0 additions & 3 deletions python/arcticdb/adapters/azure_library_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ def __init__(self, uri: str, encoding_version: EncodingVersion, *args, **kwargs)
super().__init__(uri, self._encoding_version)

def __repr__(self):
return "azure(endpoint=%s, container=%s)" % (self._endpoint, self._container)

def __str__(self):
censored_endpoint = re.sub(r"AccountKey=.+?;", "AccountKey=...;", self._endpoint)
return "azure(endpoint=%s, container=%s)" % (censored_endpoint, self._container)

Expand Down
6 changes: 6 additions & 0 deletions python/tests/integration/arcticdb/test_arctic.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,12 @@ def test_delete_date_range(arctic_library):
assert lib["symbol"].version == 1


def test_azure_repr_body_censored(arctic_library):
ac_library_repr = repr(arctic_library)
if "AccountKey=" in ac_library_repr:
assert "AccountKey=..." in ac_library_repr.split(";")


def _test_mongo_repr_body(mongo_storage: MongoDatabase):
# The arctic_uri has the PrefixingLibraryAdapterDecorator logic in it, so use mongo_uri
ac = Arctic(f"{mongo_storage.mongo_uri}/?maxPoolSize=10")
Expand Down

0 comments on commit 283e31c

Please sign in to comment.