(self)
| 233 | self.assertEqual(hasher.encode.call_args_list, [expected_call] * 3) |
| 234 | |
| 235 | def test_unusable(self): |
| 236 | encoded = make_password(None) |
| 237 | self.assertEqual( |
| 238 | len(encoded), |
| 239 | len(UNUSABLE_PASSWORD_PREFIX) + UNUSABLE_PASSWORD_SUFFIX_LENGTH, |
| 240 | ) |
| 241 | self.assertFalse(is_password_usable(encoded)) |
| 242 | self.assertFalse(check_password(None, encoded)) |
| 243 | self.assertFalse(check_password(encoded, encoded)) |
| 244 | self.assertFalse(check_password(UNUSABLE_PASSWORD_PREFIX, encoded)) |
| 245 | self.assertFalse(check_password("", encoded)) |
| 246 | self.assertFalse(check_password("lètmein", encoded)) |
| 247 | self.assertFalse(check_password("lètmeinz", encoded)) |
| 248 | with self.assertRaisesMessage(ValueError, "Unknown password hashing algorithm"): |
| 249 | identify_hasher(encoded) |
| 250 | # Assert that the unusable passwords actually contain a random part. |
| 251 | # This might fail one day due to a hash collision. |
| 252 | self.assertNotEqual(encoded, make_password(None), "Random password collision?") |
| 253 | |
| 254 | def test_unspecified_password(self): |
| 255 | """ |
nothing calls this directly
no test coverage detected