diff --git a/tests/gossip-unittests/dandelion/test_dandelion_client_block_choice.py b/tests/gossip-unittests/dandelion/test_dandelion_client_block_choice.py index f8a6aa5a..2aa4dae4 100644 --- a/tests/gossip-unittests/dandelion/test_dandelion_client_block_choice.py +++ b/tests/gossip-unittests/dandelion/test_dandelion_client_block_choice.py @@ -101,6 +101,7 @@ class OnionrGossipClientBlockChoice(unittest.TestCase): block_queue_processing() self.assertTrue(mock_store_blocks.called) + @patch('gossip.client.stem_out') def test_client_block_processing_stem_phase(self, mock_stem_out): gossip_peer_set.add(MockPeer()) diff --git a/tests/gossip-unittests/test_client_get_new_peers.py b/tests/gossip-unittests/test_client_get_new_peers.py new file mode 100644 index 00000000..b11b392f --- /dev/null +++ b/tests/gossip-unittests/test_client_get_new_peers.py @@ -0,0 +1,61 @@ +import os, uuid +from sqlite3 import Time +import socket +from queue import Queue +from time import sleep, time +import secrets + + +TEST_DIR = 'testdata/%s-%s' % (str(uuid.uuid4())[:6], os.path.basename(__file__)) + '/' +print("Test directory:", TEST_DIR) +os.environ["ONIONR_HOME"] = TEST_DIR + +from threading import Thread +import asyncio +import unittest +import sys +sys.path.append(".") +sys.path.append("src/") +from unittest.mock import patch + +import onionrblocks + + +from filepaths import gossip_server_socket_file +from gossip.client import block_queue_processing +from gossip import client +from gossip.blockqueues import gossip_block_queues +from gossip.peerset import gossip_peer_set + + +BLOCK_MAX_SIZE = 1024 * 2000 +BLOCK_MAX_SIZE_LEN = len(str(BLOCK_MAX_SIZE)) +BLOCK_ID_SIZE = 128 +BLOCK_STREAM_OFFSET_DIGITS = 8 +MAX_PEERS = 10 +TRANSPORT_SIZE_BYTES = 64 + +server_file = TEST_DIR + 'test_serv.sock' + + +class MockPeer: + def __init__(self): + self.transport_address = secrets.token_hex(16) + def __hash__(self): + return hash(self.transport_address) + + def get_socket(self, timeout): + s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + s.connect(server_file) + return s + + + +class OnionrGossipClientGetNewPeers(unittest.TestCase): + + + def test_get_new_peers(self): + return + + +unittest.main() diff --git a/tests/test_big_brother.py b/tests/release-tests/test_big_brother.py similarity index 100% rename from tests/test_big_brother.py rename to tests/release-tests/test_big_brother.py diff --git a/tests/test_default_config_json.py b/tests/release-tests/test_default_config_json.py similarity index 100% rename from tests/test_default_config_json.py rename to tests/release-tests/test_default_config_json.py