Commit Graph

12 Commits

Author SHA1 Message Date
0456e9a5f8 fix(tests): use working dir via fixture instead of cluttering cwd 2021-11-30 22:54:15 +01:00
ddf19a4362 Add first unit tests for libkeyringctl.keyring
tests/test_keyring.py:
Add tests for `is_pgp_fingerprint()`,
`transform_{fingerprint,username}_to_keyring_path()`,
`derive_username_from_fingerprint()` and get_fingerprints_from_paths()`.
2021-11-30 22:54:15 +01:00
16bed8ac4a Add fixtures for valid and invalid fingerprints
tests/conftest.py:
Add `valid_fingerprint()` and `valid_subkey_fingerprint()` fixtures to
produce a generic "valid" PGP fingerprint string.
Add the `invalid_fingerprint()` fixture to generate a set of "invalid"
fingerprint strings.
2021-11-30 22:54:15 +01:00
d9e9453d84 feature(keyringctl): write all packet files with full issuer fingerprint
This avoids collision between same issuer using key-id and full
fingerprint in different versions of a packet, like signature.
2021-11-30 22:54:15 +01:00
279765b22a fix(keyringctl): fix system stderr case due to wrongly written test
CalledProcessError returns bytes for our invocations, the fix that
decoded bytes of stdout was purely to make the mocked test happy while
breaking the actual usage. Restore the behavior and fix the wrong mocked
data.
2021-11-30 22:54:14 +01:00
cd585f4be2 chore(keyringctl): increase test coverage and fix trust expectations 2021-11-30 22:54:14 +01:00
7513e71b3f chore(keyringctl): add key revocation trust tests 2021-11-30 22:54:14 +01:00
86eb172ac3 chore(keyringctl): add missing type annotations for tests 2021-11-30 22:54:14 +01:00
358e840f8f Add unit tests for util functions
tests/test_util.py:
Add tests for `cwd()`, `natural_sort_path()`, `system()`,
`absolute_path()`, `transform_fd_to_tmpfile()`, `get_cert_paths()`,
`get_parent_cert_paths()` and `contains_fingerprint()`.
2021-11-30 22:54:14 +01:00
c1f59488e5 Add unit tests for code calling sequoia
tests/test_sequoia.py:
Add unit tests for `keyring_split()`, `keyring_merge()`,
`packet_split()`, `packet_join()`, `inspect()`, `packet_dump()`,
`packet_dump_field()`, `packet_signature_creation_time()`, and
`latest_certification()`.
2021-11-30 22:54:14 +01:00
52e0936524 Add unit test for git integration
tests/test_git.py:
Add unit test for `git_changed_files()`.
2021-11-30 22:54:14 +01:00
4597fba6ba Rename test directory to tests
tests/*:
The existing coverage configuration is setup to use/ omit a tests
directory.
2021-11-30 22:54:13 +01:00