cover 'second certificate' codepath

This commit is contained in:
meejah 2021-01-21 00:08:00 -07:00
parent 307a53dd71
commit 6560621e95
1 changed files with 16 additions and 0 deletions

View File

@ -125,6 +125,22 @@ class GridManagerCommandLine(SyncTestCase):
cert = json.loads(sigcert['certificate']) cert = json.loads(sigcert['certificate'])
self.assertEqual(cert["public_key"], pubkey) self.assertEqual(cert["public_key"], pubkey)
def test_add_and_sign_second_cert(self):
"""
Add a new storage-server and sign two certificates.
"""
pubkey = "pub-v0-cbq6hcf3pxcz6ouoafrbktmkixkeuywpcpbcomzd3lqbkq4nmfga"
with self.runner.isolated_filesystem():
self.runner.invoke(grid_manager, ["--config", "foo", "create"])
self.runner.invoke(grid_manager, ["--config", "foo", "add", "storage0", pubkey])
result = self.runner.invoke(grid_manager, ["--config", "foo", "sign", "storage0", "10"])
result = self.runner.invoke(grid_manager, ["--config", "foo", "sign", "storage0", "10"])
# we should now have two certificates stored
self.assertEqual(
set(FilePath("foo").listdir()),
{'storage0.cert.1', 'storage0.cert.0', 'config.json'},
)
def test_add_twice(self): def test_add_twice(self):
""" """
An error is reported trying to add an existing server An error is reported trying to add an existing server