Finished basic get_new_peers tests
This commit is contained in:
parent
0b4e264877
commit
1b21e25f7e
@ -51,7 +51,7 @@ fake_peer_addresses = [MockPeer().transport_address for i in range(10)]
|
|||||||
|
|
||||||
|
|
||||||
def _server():
|
def _server():
|
||||||
|
|
||||||
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as s:
|
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as s:
|
||||||
s.bind(server_file)
|
s.bind(server_file)
|
||||||
s.listen(1)
|
s.listen(1)
|
||||||
@ -70,12 +70,14 @@ class OnionrGossipClientGetNewPeers(unittest.TestCase):
|
|||||||
def test_get_new_peers_no_peers(self):
|
def test_get_new_peers_no_peers(self):
|
||||||
gossip_peer_set.clear()
|
gossip_peer_set.clear()
|
||||||
self.assertRaises(ValueError, get_new_peers)
|
self.assertRaises(ValueError, get_new_peers)
|
||||||
|
self.assertFalse(len(gossip_peer_set))
|
||||||
|
|
||||||
def test_get_new_peers(self):
|
def test_get_new_peers(self):
|
||||||
p = MockPeer()
|
p = MockPeer()
|
||||||
gossip_peer_set.add(p)
|
gossip_peer_set.add(p)
|
||||||
get_new_peers()
|
get_new_peers()
|
||||||
|
assert len(gossip_peer_set)
|
||||||
self.assertTrue(len(gossip_peer_set), len(fake_peer_addresses) + 1)
|
self.assertTrue(len(gossip_peer_set), len(fake_peer_addresses) + 1)
|
||||||
|
|
||||||
|
sleep(0.5)
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
@ -17,6 +17,11 @@ createdirs.create_dirs()
|
|||||||
setup.setup_config()
|
setup.setup_config()
|
||||||
|
|
||||||
class TestBigBrother(unittest.TestCase):
|
class TestBigBrother(unittest.TestCase):
|
||||||
|
def test_system(self):
|
||||||
|
import bigbrother
|
||||||
|
bigbrother.enable_ministries()
|
||||||
|
self.assertRaises(onionrexceptions.ArbitraryCodeExec, os.system, "echo test")
|
||||||
|
|
||||||
def test_requests_connect(self):
|
def test_requests_connect(self):
|
||||||
import bigbrother
|
import bigbrother
|
||||||
bigbrother.enable_ministries()
|
bigbrother.enable_ministries()
|
||||||
|
Loading…
Reference in New Issue
Block a user