File: test_input_io.py

package info (click to toggle)
py-rnp 0.1.0%2Bgit20221014.01b7129-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 424 kB
  • sloc: python: 3,062; sh: 8; makefile: 4
file content (13 lines) | stat: -rw-r--r-- 350 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
import io
import rnp


def test_input_io():
    rpgp = rnp.Rnp()
    rpgp.set_password_provider(lambda key, reason: "password")

    sio = io.StringIO("some secret text")
    encrypted = rpgp.symmetric_encrypt(rnp.Input.from_io(sio), "password")

    bio = io.BytesIO(encrypted)
    assert rpgp.decrypt(rnp.Input.from_io(bio)) == b"some secret text"