Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
haliphax committed Mar 1, 2023
1 parent 95c0cd0 commit b004f36
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tests/ssh/test_start_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
from unittest.mock import AsyncMock, Mock, patch

# target
from xthulu import bind_redis
from xthulu.ssh import start_server
from xthulu.ssh.server import SSHServer
from xthulu.ssh.process_factory import handle_client

# local
from tests import run_coroutine
Expand All @@ -24,10 +23,16 @@ class TestStartServer(TestCase):
}
"""Default SSH configuration for testing"""

test_config = {"db": {"bind": "test"}, "ssh": test_ssh_config}
test_config = {
"cache": {"host": "test", "port": 1234},
"db": {"bind": "test"},
"ssh": test_ssh_config,
}
"""Default overall configuration for testing"""

def setUp(self):
bind_redis()

self._patch_db = patch("xthulu.ssh.db")
self.mock_db = self._patch_db.start()

Expand All @@ -47,6 +52,9 @@ def test_db_bind(self):

@patch("xthulu.config", test_config)
def test_server_args(self):
from xthulu.ssh.server import SSHServer
from xthulu.ssh.process_factory import handle_client

run_coroutine(start_server())

ssh_config = self.test_config["ssh"]
Expand All @@ -68,7 +76,7 @@ def test_server_args(self):
"ssh": {**test_ssh_config, "proxy_protocol": True},
},
)
@patch("xthulu.ssh.ProxyProtocolListener")
@patch("xthulu.ssh.proxy_protocol.ProxyProtocolListener")
def test_proxy_procotol(self, mock_listener: Mock):
run_coroutine(start_server())

Expand Down

0 comments on commit b004f36

Please sign in to comment.