Пример #1
0
def test_cleans_details_with_password_in_list():
    details = [{"foo": "bar", "password": "******"}]
    cleaned = clean_password(details)

    assert json.loads(cleaned.replace("'", "\"")) == [{
        'foo': 'bar',
        'password': '******'
    }]
Пример #2
0
def test_ignores_details_with_no_password():
    details = {"foo": "bar"}
    cleaned = clean_password(details)

    assert str(details) == cleaned
Пример #3
0
def test_cleans_dsn_string_in_list():
    details = ["redis://:topsecret@someserver:1234/0"]
    cleaned = clean_password(details)

    assert cleaned == "['redis://:*******@someserver:1234/0']"
Пример #4
0
def test_cleans_dsn_string(details, protocol):
    cleaned = clean_password(details)

    assert cleaned == "{0}://:*******@someserver:1234/0".format(protocol)
Пример #5
0
def test_ignores_non_dsn_string():
    details = "Hello, world."
    cleaned = clean_password(details)

    assert details == cleaned
Пример #6
0
 def __repr__(self):
     connection_details = clean_password(self.connection)
     return "<%s(connection='%s'>" % (self.__class__.__name__, connection_details)