checkpoint: massive refactor
This commit is contained in:
@@ -12,40 +12,35 @@ from api_hook_client import ApiHookClient
|
||||
import gui_legacy
|
||||
|
||||
def test_hooks_enabled_via_cli():
|
||||
with patch.object(sys, 'argv', ['gui_legacy.py', '--enable-test-hooks']):
|
||||
app = gui_legacy.App()
|
||||
assert app.test_hooks_enabled is True
|
||||
with patch.object(sys, 'argv', ['gui_legacy.py', '--enable-test-hooks']):
|
||||
app = gui_legacy.App()
|
||||
assert app.test_hooks_enabled is True
|
||||
|
||||
def test_hooks_disabled_by_default():
|
||||
with patch.object(sys, 'argv', ['gui_legacy.py']):
|
||||
if 'SLOP_TEST_HOOKS' in os.environ:
|
||||
del os.environ['SLOP_TEST_HOOKS']
|
||||
app = gui_legacy.App()
|
||||
assert getattr(app, 'test_hooks_enabled', False) is False
|
||||
with patch.object(sys, 'argv', ['gui_legacy.py']):
|
||||
if 'SLOP_TEST_HOOKS' in os.environ:
|
||||
del os.environ['SLOP_TEST_HOOKS']
|
||||
app = gui_legacy.App()
|
||||
assert getattr(app, 'test_hooks_enabled', False) is False
|
||||
|
||||
def test_live_hook_server_responses(live_gui):
|
||||
"""
|
||||
"""
|
||||
Verifies the live hook server (started via fixture) responds correctly to all major endpoints.
|
||||
"""
|
||||
client = ApiHookClient()
|
||||
|
||||
# Test /status
|
||||
status = client.get_status()
|
||||
assert status == {'status': 'ok'}
|
||||
|
||||
# Test /api/project
|
||||
project = client.get_project()
|
||||
assert 'project' in project
|
||||
|
||||
# Test /api/session
|
||||
session = client.get_session()
|
||||
assert 'session' in session
|
||||
|
||||
# Test /api/performance
|
||||
perf = client.get_performance()
|
||||
assert 'performance' in perf
|
||||
|
||||
# Test POST /api/gui
|
||||
gui_data = {"action": "test_action", "value": 42}
|
||||
resp = client.post_gui(gui_data)
|
||||
assert resp == {'status': 'queued'}
|
||||
client = ApiHookClient()
|
||||
# Test /status
|
||||
status = client.get_status()
|
||||
assert status == {'status': 'ok'}
|
||||
# Test /api/project
|
||||
project = client.get_project()
|
||||
assert 'project' in project
|
||||
# Test /api/session
|
||||
session = client.get_session()
|
||||
assert 'session' in session
|
||||
# Test /api/performance
|
||||
perf = client.get_performance()
|
||||
assert 'performance' in perf
|
||||
# Test POST /api/gui
|
||||
gui_data = {"action": "test_action", "value": 42}
|
||||
resp = client.post_gui(gui_data)
|
||||
assert resp == {'status': 'queued'}
|
||||
|
||||
Reference in New Issue
Block a user