Finished basic get_new_peers tests

This commit is contained in:
Kevin F 2022-05-15 23:21:45 -05:00
parent 0b4e264877
commit 1b21e25f7e
2 changed files with 9 additions and 2 deletions

View File

@ -51,7 +51,7 @@ fake_peer_addresses = [MockPeer().transport_address for i in range(10)]
def _server():
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as s:
s.bind(server_file)
s.listen(1)
@ -70,12 +70,14 @@ class OnionrGossipClientGetNewPeers(unittest.TestCase):
def test_get_new_peers_no_peers(self):
gossip_peer_set.clear()
self.assertRaises(ValueError, get_new_peers)
self.assertFalse(len(gossip_peer_set))
def test_get_new_peers(self):
p = MockPeer()
gossip_peer_set.add(p)
get_new_peers()
assert len(gossip_peer_set)
self.assertTrue(len(gossip_peer_set), len(fake_peer_addresses) + 1)
sleep(0.5)
unittest.main()

View File

@ -17,6 +17,11 @@ createdirs.create_dirs()
setup.setup_config()
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):
import bigbrother
bigbrother.enable_ministries()