diff options
author | Michael Mercier <michael.mercier@ryax.tech> | 2021-03-16 10:00:51 +0100 |
---|---|---|
committer | Michael Mercier <michael.mercier@ryax.tech> | 2021-03-16 10:16:34 +0100 |
commit | ffddedf5467df993b7a42fbd15afacb901bca6d7 (patch) | |
tree | b43ffc85ba78261e9446e5a9446de82054d707dc /test/test_util.py | |
parent | 50cbafc690e5692a16148dbde9de680be70ddbd1 (diff) | |
download | gitpython-ffddedf5467df993b7a42fbd15afacb901bca6d7.tar.gz |
Use copy and not inplace remove password + working case test
Diffstat (limited to 'test/test_util.py')
-rw-r--r-- | test/test_util.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/test/test_util.py b/test/test_util.py index a4963264..ddc5f628 100644 --- a/test/test_util.py +++ b/test/test_util.py @@ -325,7 +325,6 @@ class TestUtils(TestBase): self.assertEqual(t1._name, t2._name) def test_remove_password_from_command_line(self): - """Check that the password is not printed on the logs""" password = "fakepassword1234" url_with_pass = "https://fakeuser:{}@fakerepo.example.com/testrepo".format(password) url_without_pass = "https://fakerepo.example.com/testrepo" @@ -334,6 +333,10 @@ class TestUtils(TestBase): cmd_2 = ["git", "clone", "-v", url_without_pass] cmd_3 = ["no", "url", "in", "this", "one"] - assert password not in remove_password_if_present(cmd_1) + redacted_cmd_1 = remove_password_if_present(cmd_1) + assert password not in " ".join(redacted_cmd_1) + # Check that we use a copy + assert cmd_1 is not redacted_cmd_1 + assert password in " ".join(cmd_1) assert cmd_2 == remove_password_if_present(cmd_2) assert cmd_3 == remove_password_if_present(cmd_3) |