()
| 30 | @pytest.mark.skipif(platform.system() == "Windows", reason="Not applicable in windows") |
| 31 | @pytest.mark.skipif(not setproctitle, reason="setproctitle not available") |
| 32 | def 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 | |
| 62 | def test_format_output(): |
nothing calls this directly
no test coverage detected