Example #1
0
 def setUp(self):
     self.factory = NetworkOperator(Pager())
     self.protocol = NetworkOperatorProtocol()
     self.factory.protocol = self.protocol
     self.pseudonym_provider = SimpleProtocol()
     self.pseudonym_provider.transport = proto_helpers.StringTransport()
     self.factory.pseudonym_provider = self.pseudonym_provider
Example #2
0
class TestCidsHandling(unittest.TestCase):
    def setUp(self):
        self.factory = NetworkOperator(Pager())
        self.protocol = NetworkOperatorProtocol()
        self.factory.protocol = self.protocol
        self.pseudonym_provider = SimpleProtocol()
        self.pseudonym_provider.transport = proto_helpers.StringTransport()
        self.factory.pseudonym_provider = self.pseudonym_provider

    def tearDown(self):
        self.factory.cleanup()

    def test_store_cid(self):
        cid = pick_random()
        self.factory.store_cid(cid)
        self.assertEqual(self.factory.cids, [cid])
        self.factory.connect_call(cid, self.protocol)
        self.assertEqual(self.factory.cids, [])