Added test for multiple client publications
This commit is contained in:
parent
4db6393f9b
commit
96d7e00830
|
@ -72,6 +72,18 @@ class GivenBrokerAndTorchAgent(unittest.TestCase):
|
||||||
database = self.loadDatabase()
|
database = self.loadDatabase()
|
||||||
self.assertEqual(database['client2']['onionAddress'], "crazy_onion2.onion")
|
self.assertEqual(database['client2']['onionAddress'], "crazy_onion2.onion")
|
||||||
|
|
||||||
|
def test_when_agent_publishes_multiple_hosts_should_provide_latest(self):
|
||||||
|
self.run_subscriber()
|
||||||
|
agent_publish("client2", "crazy_onion2-34.onion")
|
||||||
|
agent_publish("client3", "crazy_onion3.onion")
|
||||||
|
agent_publish("client1", "crazy_onion1.onion")
|
||||||
|
agent_publish("client2", "crazy_onion2-56.onion")
|
||||||
|
agent_publish("client3", "crazy_onion3.onion")
|
||||||
|
database = self.loadDatabase()
|
||||||
|
self.assertEqual(database['client1']['onionAddress'], "crazy_onion1.onion")
|
||||||
|
self.assertEqual(database['client2']['onionAddress'], "crazy_onion2-56.onion")
|
||||||
|
self.assertEqual(database['client3']['onionAddress'], "crazy_onion3.onion")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run_subscriber():
|
def run_subscriber():
|
||||||
threading.Thread(target=torch_sub.subscribe,
|
threading.Thread(target=torch_sub.subscribe,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user