Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions sros2/test/sros2/commands/security/verbs/test_create_keystore.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ def test_create_keystore(keystore_dir):
assert all(x.is_file() for x in expected_files)


def test_create_keystore_twice(keystore_dir):
# Create the keystore
assert cli.main(argv=['security', 'create_keystore', keystore_dir]) == 0
expected_files = (
'ca.cert.pem', 'ca.key.pem', 'governance.p7s', 'governance.xml'
)
assert len(os.listdir(keystore_dir)) == len(expected_files)

for expected_file in expected_files:
assert os.path.isfile(os.path.join(keystore_dir, expected_file))


def test_ca_cert(keystore_dir):
with (keystore_dir / 'public' / 'ca.cert.pem').open('rb') as f:
cert = x509.load_pem_x509_certificate(f.read(), cryptography_backend())
Expand Down