Tests that a login path file with a corrupted pad is partially read.
()
| 72 | |
| 73 | |
| 74 | def test_corrupted_pad(): |
| 75 | """Tests that a login path file with a corrupted pad is partially read.""" |
| 76 | buf = open_bmylogin_cnf(LOGIN_PATH_FILE) |
| 77 | |
| 78 | # Skip past the login key |
| 79 | buf.seek(24) |
| 80 | |
| 81 | # Skip option group |
| 82 | len_buf = buf.read(4) |
| 83 | (cipher_len,) = struct.unpack("<i", len_buf) |
| 84 | buf.read(cipher_len) |
| 85 | |
| 86 | # Corrupt the pad for the user line |
| 87 | len_buf = buf.read(4) |
| 88 | (cipher_len,) = struct.unpack("<i", len_buf) |
| 89 | buf.read(cipher_len - 1) |
| 90 | buf.write(b"\0") |
| 91 | |
| 92 | buf.seek(0) |
| 93 | mylogin_cnf = TextIOWrapper(read_and_decrypt_mylogin_cnf(buf)) |
| 94 | contents = mylogin_cnf.read() |
| 95 | for word in ("[test]", "password", "host", "port"): |
| 96 | assert word in contents |
| 97 | assert "user" not in contents |
| 98 | |
| 99 | |
| 100 | def test_get_mylogin_cnf_path(monkeypatch): |
nothing calls this directly
no test coverage detected