MCPcopy Index your code
hub / github.com/dbcli/pgcli / test_obfuscate_process_password

Function test_obfuscate_process_password

tests/test_main.py:32–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30@pytest.mark.skipif(platform.system() == "Windows", reason="Not applicable in windows")
31@pytest.mark.skipif(not setproctitle, reason="setproctitle not available")
32def test_obfuscate_process_password():
33 original_title = setproctitle.getproctitle()
34
35 setproctitle.setproctitle("pgcli user=root password=secret host=localhost")
36 obfuscate_process_password()
37 title = setproctitle.getproctitle()
38 expected = "pgcli user=root password=xxxx host=localhost"
39 assert title == expected
40
41 setproctitle.setproctitle("pgcli user=root password=top secret host=localhost")
42 obfuscate_process_password()
43 title = setproctitle.getproctitle()
44 expected = "pgcli user=root password=xxxx host=localhost"
45 assert title == expected
46
47 setproctitle.setproctitle("pgcli user=root password=top secret")
48 obfuscate_process_password()
49 title = setproctitle.getproctitle()
50 expected = "pgcli user=root password=xxxx"
51 assert title == expected
52
53 setproctitle.setproctitle("pgcli postgres://root:secret@localhost/db")
54 obfuscate_process_password()
55 title = setproctitle.getproctitle()
56 expected = "pgcli postgres://root:xxxx@localhost/db"
57 assert title == expected
58
59 setproctitle.setproctitle(original_title)
60
61
62def test_format_output():

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected