File: test_default_key.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 (22 lines) | stat: -rw-r--r-- 568 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import pytest
import rnp


@pytest.fixture
def rpgp():
    lib = rnp.Rnp()
    lib.load_keys(rnp.Input.from_path("tests/data/keyrings/gpg/pubring.gpg"), "GPG")
    lib.load_keys(rnp.Input.from_path("tests/data/keyrings/gpg/secring.gpg"), "GPG")
    return lib


@pytest.fixture
def key(rpgp):
    return rpgp.find_key_by_id("7bc6709b15c23a4a")


def test_key_to(key):
    assert key.to("sign").keyid() == key.keyid()
    assert key.to("certify").keyid() == key.keyid()
    assert key.to("sign", True) is None
    assert key.to("encrypt").keyid() == "8A05B89FAD5ADED1"