From 66de141b8a8a7e0b667048cab672acf5b02c0187 Mon Sep 17 00:00:00 2001 From: meejah Date: Mon, 4 Jan 2021 16:10:20 -0700 Subject: [PATCH] test: list certs from stdin --- src/allmydata/test/cli/test_grid_manager.py | 26 +++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/allmydata/test/cli/test_grid_manager.py b/src/allmydata/test/cli/test_grid_manager.py index 8c8ab8140..4bb82a433 100644 --- a/src/allmydata/test/cli/test_grid_manager.py +++ b/src/allmydata/test/cli/test_grid_manager.py @@ -1,6 +1,9 @@ import os import json +from io import ( + BytesIO, +) from ..common import ( SyncTestCase, @@ -85,6 +88,29 @@ class GridManagerCommandLine(SyncTestCase): set(config.keys()), ) + def test_list_stdout(self): + """ + Load Grid Manager without files (using 'list' subcommand, but any will do) + """ + config = { + "storage_servers": { + "storage0": { + "public_key": "pub-v0-cbq6hcf3pxcz6ouoafrbktmkixkeuywpcpbcomzd3lqbkq4nmfga" + } + }, + "private_key": "priv-v0-6uinzyaxy3zvscwgsps5pxcfezhrkfb43kvnrbrhhfzyduyqnniq", + "grid_manager_config_version": 0 + } + result = self.runner.invoke( + grid_manager, ["--config", "-", "list"], + input=BytesIO(json.dumps(config)), + ) + self.assertEqual(result.exit_code, 0) + self.assertEqual( + "storage0: pub-v0-cbq6hcf3pxcz6ouoafrbktmkixkeuywpcpbcomzd3lqbkq4nmfga\n", + result.output, + ) + def test_add_and_sign(self): """ Add a new storage-server and sign a certificate for it