Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion aos/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


def redacted(d):
if d is None:
if d is None or d == '':
return d

h = d.copy()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

NAME = "aos-api-client"

VERSION = '0.1.9'
VERSION = '0.1.10'


REQUIRES = (["requests==2.24.0"],)
Expand Down
28 changes: 28 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

# Copyright 2020-present, Apstra, Inc. All rights reserved.
#
# This source code is licensed under End User License Agreement found in the
# LICENSE file at http://www.apstra.com/eula
# pylint: disable=redefined-outer-name

from aos.utils import redacted


def test_redacted_null():
assert redacted(None) is None


def test_redacted_empty():
assert redacted('') == ''


def test_redacted_sensitive():
for sensitive in ["password", "token", "AuthToken"]:
d = {
'usual': 'usual data',
sensitive: '{sensitive} data',
}
assert redacted(d) == {
'usual': 'usual data',
sensitive: '<REDACTED>',
}