コード例 #1
0
 def test_jail_singlePrisonerErrback(self):
     self.refresh()
     q = Quarantine(self.pc.ping, self.rt)
     n = Node(2**35, ("127.0.0.1", 255))
     q.jail(n)
     self.assertFalse(n in self.rt.nodes)
     self.assertTrue(n in q.prison)
     self.pc.current_deferred.errback(TimeoutError(""))
     self.assertTrue(n in q.prison)
     self.assertFalse(n in self.rt.nodes)
コード例 #2
0
ファイル: test_quarantine.py プロジェクト: aburan28/DHTBot
 def test_jail_singlePrisonerErrback(self):
     self.refresh()
     q = Quarantine(self.pc.ping, self.rt)
     n = Node(2**35, ("127.0.0.1", 255))
     q.jail(n)
     self.assertFalse(n in self.rt.nodes)
     self.assertTrue(n in q.prison)
     self.pc.current_deferred.errback(TimeoutError(""))
     self.assertTrue(n in q.prison)
     self.assertFalse(n in self.rt.nodes)
コード例 #3
0
ファイル: test_quarantine.py プロジェクト: aburan28/DHTBot
 def test_jail_singlePrisonerCallBack(self):
     self.refresh()
     q = Quarantine(self.pc.ping, self.rt)
     n = Node(2**30, ("127.0.0.1", 555))
     q.jail(n)
     # The node should be inserted into the routing
     # table after it 'responds' to a query
     self.assertFalse(n in self.rt.nodes)
     self.assertTrue(n in q.prison)
     self.pc.current_deferred.callback(None)
     self.assertTrue(n in self.rt.nodes)
     self.assertFalse(n in q.prison)
コード例 #4
0
 def test_jail_singlePrisonerCallBack(self):
     self.refresh()
     q = Quarantine(self.pc.ping, self.rt)
     n = Node(2**30, ("127.0.0.1", 555))
     q.jail(n)
     # The node should be inserted into the routing
     # table after it 'responds' to a query
     self.assertFalse(n in self.rt.nodes)
     self.assertTrue(n in q.prison)
     self.pc.current_deferred.callback(None)
     self.assertTrue(n in self.rt.nodes)
     self.assertFalse(n in q.prison)
コード例 #5
0
ファイル: test_quarantine.py プロジェクト: aburan28/DHTBot
 def test_jail_singlePrisonerErrbackThenCallback(self):
     self.refresh()
     q = Quarantine(self.pc.ping, self.rt)
     n = Node(2**51, ("127.0.0.1", 9555))
     q.jail(n)
     self.assertFalse(n in self.rt.nodes)
     self.assertTrue(n in q.prison)
     self.pc.current_deferred.errback(TimeoutError(""))
     # After the errback, the quarantine should try to
     # ping the node one last time
     self.assertFalse(n in self.rt.nodes)
     self.assertTrue(n in q.prison)
     self.pc.current_deferred.callback("")
     self.assertTrue(n in self.rt.nodes)
     self.assertFalse(n in q.prison)
コード例 #6
0
 def test_jail_singlePrisonerErrbackThenCallback(self):
     self.refresh()
     q = Quarantine(self.pc.ping, self.rt)
     n = Node(2**51, ("127.0.0.1", 9555))
     q.jail(n)
     self.assertFalse(n in self.rt.nodes)
     self.assertTrue(n in q.prison)
     self.pc.current_deferred.errback(TimeoutError(""))
     # After the errback, the quarantine should try to
     # ping the node one last time
     self.assertFalse(n in self.rt.nodes)
     self.assertTrue(n in q.prison)
     self.pc.current_deferred.callback("")
     self.assertTrue(n in self.rt.nodes)
     self.assertFalse(n in q.prison)
コード例 #7
0
ファイル: test_quarantine.py プロジェクト: aburan28/DHTBot
 def test_jail_singlePrisoner(self):
     self.refresh()
     q = Quarantine(self.pc.ping, self.rt)
     n = Node(2**150, ("127.0.0.1", 58))
     q.jail(n)
     self.assertEquals(1, self.pc.ping_count)
コード例 #8
0
 def test_jail_singlePrisoner(self):
     self.refresh()
     q = Quarantine(self.pc.ping, self.rt)
     n = Node(2**150, ("127.0.0.1", 58))
     q.jail(n)
     self.assertEquals(1, self.pc.ping_count)