server IDs/node IDS should be bytes.

This commit is contained in:
Itamar Turner-Trauring 2020-12-17 09:41:14 -05:00
parent b5f2afe39c
commit 33392502d3
3 changed files with 8 additions and 7 deletions

View File

@ -464,6 +464,7 @@ class StorageFarmBroker(service.MultiService):
@implementer(IDisplayableServer) @implementer(IDisplayableServer)
class StubServer(object): class StubServer(object):
def __init__(self, serverid): def __init__(self, serverid):
assert isinstance(serverid, bytes)
self.serverid = serverid # binary tubid self.serverid = serverid # binary tubid
def get_serverid(self): def get_serverid(self):
return self.serverid return self.serverid

View File

@ -143,12 +143,12 @@ class DownloadStatusElementTests(TrialTestCase):
See if we can render the page almost fully. See if we can render the page almost fully.
""" """
status = FakeDownloadStatus( status = FakeDownloadStatus(
"si-1", 123, b"si-1", 123,
["s-1", "s-2", "s-3"], [b"s-1", b"s-2", b"s-3"],
{"s-1": "unknown problem"}, {b"s-1": "unknown problem"},
{"s-1": [1], "s-2": [1,2], "s-3": [2,3]}, {b"s-1": [1], b"s-2": [1,2], b"s-3": [2,3]},
{"fetch_per_server": {"fetch_per_server":
{"s-1": [1], "s-2": [2,3], "s-3": [3,2]}} {b"s-1": [1], b"s-2": [2,3], b"s-3": [3,2]}}
) )
result = self._render_download_status_element(status) result = self._render_download_status_element(status)

View File

@ -261,7 +261,7 @@ class FakeClient(_Client):
# minimal subset # minimal subset
service.MultiService.__init__(self) service.MultiService.__init__(self)
self.all_contents = {} self.all_contents = {}
self.nodeid = "fake_nodeid" self.nodeid = b"fake_nodeid"
self.nickname = u"fake_nickname \u263A" self.nickname = u"fake_nickname \u263A"
self.introducer_furls = [] self.introducer_furls = []
self.introducer_clients = [] self.introducer_clients = []
@ -277,7 +277,7 @@ class FakeClient(_Client):
# fake knowledge of another server # fake knowledge of another server
self.storage_broker.test_add_server("other_nodeid", self.storage_broker.test_add_server("other_nodeid",
FakeDisplayableServer( FakeDisplayableServer(
serverid="other_nodeid", nickname=u"other_nickname \u263B", connected = True, serverid=b"other_nodeid", nickname=u"other_nickname \u263B", connected = True,
last_connect_time = 10, last_loss_time = 20, last_rx_time = 30)) last_connect_time = 10, last_loss_time = 20, last_rx_time = 30))
self.storage_broker.test_add_server("disconnected_nodeid", self.storage_broker.test_add_server("disconnected_nodeid",
FakeDisplayableServer( FakeDisplayableServer(