mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-02 09:17:59 +00:00
more utests
This commit is contained in:
parent
6e1bb1ecd5
commit
b6fbfeee48
@ -565,7 +565,7 @@ def create_storage_farm_broker(config, default_connection_handlers, foolscap_con
|
|||||||
grid_manager_keys = []
|
grid_manager_keys = []
|
||||||
for name, gm_key in config.enumerate_section('grid_managers').items():
|
for name, gm_key in config.enumerate_section('grid_managers').items():
|
||||||
grid_manager_keys.append(
|
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
|
# we don't actually use this keypair for anything (yet) as far
|
||||||
|
@ -7,6 +7,7 @@ from twisted.python.filepath import (
|
|||||||
|
|
||||||
from allmydata.client import (
|
from allmydata.client import (
|
||||||
create_storage_farm_broker,
|
create_storage_farm_broker,
|
||||||
|
_load_grid_manager_certificates,
|
||||||
)
|
)
|
||||||
from allmydata.node import (
|
from allmydata.node import (
|
||||||
config_from_string,
|
config_from_string,
|
||||||
@ -70,7 +71,7 @@ class GridManagerUtilities(SyncTestCase):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
sfb.set_static_servers(static_servers)
|
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
|
# we have some grid-manager keys defined so the server should
|
||||||
# only upload if there's a valid certificate -- but the only
|
# only upload if there's a valid certificate -- but the only
|
||||||
@ -79,11 +80,12 @@ class GridManagerUtilities(SyncTestCase):
|
|||||||
|
|
||||||
def test_load_certificates(self):
|
def test_load_certificates(self):
|
||||||
cert_path = self.mktemp()
|
cert_path = self.mktemp()
|
||||||
with open(cert_path, "w") as f:
|
fake_cert = {
|
||||||
f.write(json.dumps({
|
|
||||||
"certificate": "{\"expires\":1601687822,\"public_key\":\"pub-v0-cbq6hcf3pxcz6ouoafrbktmkixkeuywpcpbcomzd3lqbkq4nmfga\",\"version\":1}",
|
"certificate": "{\"expires\":1601687822,\"public_key\":\"pub-v0-cbq6hcf3pxcz6ouoafrbktmkixkeuywpcpbcomzd3lqbkq4nmfga\",\"version\":1}",
|
||||||
"signature": "fvjd3uvvupf2v6tnvkwjd473u3m3inyqkwiclhp7balmchkmn3px5pei3qyfjnhymq4cjcwvbpqmcwwnwswdtrfkpnlaxuih2zbdmda"
|
"signature": "fvjd3uvvupf2v6tnvkwjd473u3m3inyqkwiclhp7balmchkmn3px5pei3qyfjnhymq4cjcwvbpqmcwwnwswdtrfkpnlaxuih2zbdmda"
|
||||||
}))
|
}
|
||||||
|
with open(cert_path, "w") as f:
|
||||||
|
f.write(json.dumps(fake_cert))
|
||||||
config_data = (
|
config_data = (
|
||||||
"[grid_managers]\n"
|
"[grid_managers]\n"
|
||||||
"fluffy = pub-v0-vqimc4s5eflwajttsofisp5st566dbq36xnpp4siz57ufdavpvlq\n"
|
"fluffy = pub-v0-vqimc4s5eflwajttsofisp5st566dbq36xnpp4siz57ufdavpvlq\n"
|
||||||
@ -95,6 +97,8 @@ class GridManagerUtilities(SyncTestCase):
|
|||||||
1,
|
1,
|
||||||
len(config.enumerate_section("grid_managers"))
|
len(config.enumerate_section("grid_managers"))
|
||||||
)
|
)
|
||||||
|
certs = _load_grid_manager_certificates(config)
|
||||||
|
self.assertEqual([fake_cert], certs)
|
||||||
|
|
||||||
|
|
||||||
class GridManagerVerifier(SyncTestCase):
|
class GridManagerVerifier(SyncTestCase):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user