more utests

This commit is contained in:
meejah 2020-11-13 18:23:21 -07:00
parent 6e1bb1ecd5
commit b6fbfeee48
2 changed files with 10 additions and 6 deletions

View File

@ -565,7 +565,7 @@ def create_storage_farm_broker(config, default_connection_handlers, foolscap_con
grid_manager_keys = []
for name, gm_key in config.enumerate_section('grid_managers').items():
grid_manager_keys.append(
ed25519.verifying_key_from_string(gm_key)
ed25519.verifying_key_from_string(gm_key.encode("ascii"))
)
# we don't actually use this keypair for anything (yet) as far

View File

@ -7,6 +7,7 @@ from twisted.python.filepath import (
from allmydata.client import (
create_storage_farm_broker,
_load_grid_manager_certificates,
)
from allmydata.node import (
config_from_string,
@ -70,7 +71,7 @@ class GridManagerUtilities(SyncTestCase):
}
}
sfb.set_static_servers(static_servers)
nss = sfb._make_storage_server(u"server0", {"ann": announcement})
nss = sfb._make_storage_server(b"server0", {"ann": announcement})
# we have some grid-manager keys defined so the server should
# only upload if there's a valid certificate -- but the only
@ -79,11 +80,12 @@ class GridManagerUtilities(SyncTestCase):
def test_load_certificates(self):
cert_path = self.mktemp()
with open(cert_path, "w") as f:
f.write(json.dumps({
fake_cert = {
"certificate": "{\"expires\":1601687822,\"public_key\":\"pub-v0-cbq6hcf3pxcz6ouoafrbktmkixkeuywpcpbcomzd3lqbkq4nmfga\",\"version\":1}",
"signature": "fvjd3uvvupf2v6tnvkwjd473u3m3inyqkwiclhp7balmchkmn3px5pei3qyfjnhymq4cjcwvbpqmcwwnwswdtrfkpnlaxuih2zbdmda"
}))
}
with open(cert_path, "w") as f:
f.write(json.dumps(fake_cert))
config_data = (
"[grid_managers]\n"
"fluffy = pub-v0-vqimc4s5eflwajttsofisp5st566dbq36xnpp4siz57ufdavpvlq\n"
@ -95,6 +97,8 @@ class GridManagerUtilities(SyncTestCase):
1,
len(config.enumerate_section("grid_managers"))
)
certs = _load_grid_manager_certificates(config)
self.assertEqual([fake_cert], certs)
class GridManagerVerifier(SyncTestCase):