Ejemplo n.º 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': '******'
    }]
Ejemplo n.º 2
0
def test_ignores_details_with_no_password():
    details = {"foo": "bar"}
    cleaned = clean_password(details)

    assert str(details) == cleaned
Ejemplo n.º 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']"
Ejemplo n.º 4
0
def test_cleans_dsn_string(details, protocol):
    cleaned = clean_password(details)

    assert cleaned == "{0}://:*******@someserver:1234/0".format(protocol)
Ejemplo n.º 5
0
def test_ignores_non_dsn_string():
    details = "Hello, world."
    cleaned = clean_password(details)

    assert details == cleaned
Ejemplo n.º 6
0
 def __repr__(self):
     connection_details = clean_password(self.connection)
     return "<%s(connection='%s'>" % (self.__class__.__name__, connection_details)