()
| 49 | |
| 50 | |
| 51 | def test_cryptical_dumps_valid_nonce(): |
| 52 | nonce = uuid.uuid4().hex |
| 53 | master_crypt = salt.crypt.Crypticle({}, salt.crypt.Crypticle.generate_key_string()) |
| 54 | data = {"foo": "bar"} |
| 55 | ret = master_crypt.dumps(data, nonce=nonce) |
| 56 | |
| 57 | assert isinstance(ret, bytes) |
| 58 | une = master_crypt.decrypt(ret) |
| 59 | une.startswith(master_crypt.PICKLE_PAD) |
| 60 | nonce_and_data = une[len(master_crypt.PICKLE_PAD) :] |
| 61 | assert nonce_and_data.startswith(nonce.encode()) |
| 62 | assert salt.payload.loads(nonce_and_data[len(nonce) :]) == data |
| 63 | |
| 64 | assert master_crypt.loads(ret, nonce=nonce) == data |
| 65 | |
| 66 | |
| 67 | def test_cryptical_dumps_invalid_nonce(): |
nothing calls this directly
no test coverage detected