Esempio n. 1
0
 def test_getAllClients(self):
     service = RegionService(sentinel.ipcWorker)
     uuid1 = factory.make_UUID()
     c1 = DummyConnection()
     c2 = DummyConnection()
     service.connections[uuid1].update({c1, c2})
     uuid2 = factory.make_UUID()
     c3 = DummyConnection()
     c4 = DummyConnection()
     service.connections[uuid2].update({c3, c4})
     clients = service.getAllClients()
     self.assertThat(list(clients), MatchesAny(
         MatchesSetwise(
             Equals(RackClient(c1, {})), Equals(RackClient(c3, {}))),
         MatchesSetwise(
             Equals(RackClient(c1, {})), Equals(RackClient(c4, {}))),
         MatchesSetwise(
             Equals(RackClient(c2, {})), Equals(RackClient(c3, {}))),
         MatchesSetwise(
             Equals(RackClient(c2, {})), Equals(RackClient(c4, {}))),
     ))
Esempio n. 2
0
 def test_getAllClients_empty_connections(self):
     service = RegionService(sentinel.ipcWorker)
     service.connections.clear()
     uuid1 = factory.make_UUID()
     service.connections[uuid1] = set()
     self.assertThat(service.getAllClients(), Equals([]))
Esempio n. 3
0
 def test_getAllClients_empty(self):
     service = RegionService(sentinel.ipcWorker)
     service.connections.clear()
     self.assertThat(service.getAllClients(), Equals([]))