Add tests for introspection and export
libkeyringctl/keyring.py: Change `get_packets_from_path()` to use full conditional statements which is easier to cover in tests. tests/test_keyring.py: Add simple tests for `get_packets_from_path()`, `get_packets_from_listing()`, `export()` and `build()`.
This commit is contained in:
committed by
Levente Polyak
parent
8689995b69
commit
743d2bb3bb
@ -754,17 +754,16 @@ def get_packets_from_path(path: Path) -> List[Path]:
|
||||
-------
|
||||
A list of packets ordered by root, certification, revocation
|
||||
"""
|
||||
|
||||
if not path.exists():
|
||||
return []
|
||||
|
||||
packets: List[Path] = []
|
||||
packets += sorted(path.glob("*.asc"))
|
||||
certifications = path / "certification"
|
||||
if certifications.exists():
|
||||
packets += sorted(certifications.glob("*.asc"))
|
||||
revocations = path / "revocation"
|
||||
if revocations.exists():
|
||||
packets += sorted(revocations.glob("*.asc"))
|
||||
packets += sorted(certifications.glob("*.asc")) if certifications.exists() else []
|
||||
packets += sorted(revocations.glob("*.asc")) if revocations.exists() else []
|
||||
return packets
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user