(self, backend)
| 212 | MultiFernet(None) # type: ignore[arg-type] |
| 213 | |
| 214 | def test_rotate_bytes(self, backend): |
| 215 | f1 = Fernet(base64.urlsafe_b64encode(b"\x00" * 32), backend=backend) |
| 216 | f2 = Fernet(base64.urlsafe_b64encode(b"\x01" * 32), backend=backend) |
| 217 | |
| 218 | mf1 = MultiFernet([f1]) |
| 219 | mf2 = MultiFernet([f2, f1]) |
| 220 | |
| 221 | plaintext = b"abc" |
| 222 | mf1_ciphertext = mf1.encrypt(plaintext) |
| 223 | |
| 224 | assert mf2.decrypt(mf1_ciphertext) == plaintext |
| 225 | |
| 226 | rotated = mf2.rotate(mf1_ciphertext) |
| 227 | |
| 228 | assert rotated != mf1_ciphertext |
| 229 | assert mf2.decrypt(rotated) == plaintext |
| 230 | |
| 231 | with pytest.raises(InvalidToken): |
| 232 | mf1.decrypt(rotated) |
| 233 | |
| 234 | def test_rotate_str(self, backend): |
| 235 | f1 = Fernet(base64.urlsafe_b64encode(b"\x00" * 32), backend=backend) |
nothing calls this directly
no test coverage detected