From 6c9632b5ece73727a64fe74baa200c77ee1a3713 Mon Sep 17 00:00:00 2001 From: meejah Date: Mon, 4 Jan 2021 16:10:32 -0700 Subject: [PATCH] test: missing cert from config is reported --- src/allmydata/test/test_grid_manager.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/allmydata/test/test_grid_manager.py b/src/allmydata/test/test_grid_manager.py index 4c899257d..c3b85bbee 100644 --- a/src/allmydata/test/test_grid_manager.py +++ b/src/allmydata/test/test_grid_manager.py @@ -89,7 +89,25 @@ class GridManagerUtilities(SyncTestCase): ) certs = config.get_grid_manager_certificates() self.assertEqual([fake_cert], certs) - print(certs) + + def test_load_certificates_missing(self): + """ + An error is reported for missing certificates + """ + cert_path = self.mktemp() + config_data = ( + "[grid_managers]\n" + "fluffy = pub-v0-vqimc4s5eflwajttsofisp5st566dbq36xnpp4siz57ufdavpvlq\n" + "[grid_manager_certificates]\n" + "ding = {}\n".format(cert_path) + ) + config = config_from_string("/foo", "portnum", config_data, client_valid_config()) + with self.assertRaises(ValueError) as ctx: + certs = config.get_grid_manager_certificates() + self.assertIn( + "Grid Manager certificate file '{}' doesn't exist".format(cert_path), + str(ctx.exception) + ) class GridManagerVerifier(SyncTestCase):