Skip to content

Commit 4ce45b2

Browse files
author
Tom Softreck
committed
update
1 parent dd6f16c commit 4ce45b2

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

tests/test_webtask.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
import pytest
66
from unittest.mock import patch, MagicMock
7-
from webtask.server import webtaskServer
7+
from webtask.server import webtaskServer, WebTaskHandler
88
from webtask.main import main
99

1010

11-
class TestwebtaskServer:
11+
class TestWebTaskServer:
1212
"""Test webtaskServer class"""
1313

1414
def test_server_initialization(self):
@@ -17,6 +17,12 @@ def test_server_initialization(self):
1717
assert server.host == "localhost"
1818
assert server.port == 8000
1919
assert server.open_browser is True
20+
21+
def test_webtask_handler_initialization(self):
22+
"""Test WebTaskHandler initialization"""
23+
handler = WebTaskHandler(None, ('127.0.0.1', 12345), None)
24+
assert hasattr(handler, 'directory')
25+
assert 'static' in str(handler.directory)
2026

2127
def test_server_initialization_with_params(self):
2228
"""Test server initialization with custom parameters"""
@@ -29,8 +35,8 @@ def test_server_initialization_with_params(self):
2935
class TestMain:
3036
"""Test main entry point"""
3137

32-
@patch('webtop.main.WebTopServer')
33-
@patch('sys.argv', ['webtop'])
38+
@patch('webtask.main.webtaskServer')
39+
@patch('sys.argv', ['webtask'])
3440
def test_main_default_args(self, mock_server_class):
3541
"""Test main function with default arguments"""
3642
mock_server = MagicMock()
@@ -45,8 +51,8 @@ def test_main_default_args(self, mock_server_class):
4551
)
4652
mock_server.run.assert_called_once()
4753

48-
@patch('webtop.main.WebTopServer')
49-
@patch('sys.argv', ['webtop', '--host', '0.0.0.0', '--port', '9000', '--no-browser'])
54+
@patch('webtask.main.webtaskServer')
55+
@patch('sys.argv', ['webtask', '--host', '0.0.0.0', '--port', '9000', '--no-browser'])
5056
def test_main_custom_args(self, mock_server_class):
5157
"""Test main function with custom arguments"""
5258
mock_server = MagicMock()

0 commit comments

Comments
 (0)