MCPcopy
hub / github.com/tanelpoder/0xtools / test_cli_mapping

Function test_cli_mapping

xtop/tests/test_tui_mapping.py:236–269  ·  view source on GitHub ↗

Generic test function that executes a CLI test case in TUI

(test_case: CLITestCase)

Source from the content-addressed store, hash-verified

234
235@pytest.mark.asyncio
236async def test_cli_mapping(test_case: CLITestCase):
237 """Generic test function that executes a CLI test case in TUI"""
238 wrapper = XtopTUIWrapper(
239 datadir=XCAPTURE_DATADIR,
240 low_time=datetime.fromisoformat("2025-08-03T03:40:00"),
241 high_time=datetime.fromisoformat("2025-08-03T04:07:00")
242 )
243 app = wrapper.create_app()
244
245 async with app.run_test(size=(140, 50)) as pilot:
246 # Wait for initial load
247 await pilot.pause()
248 await wait_for_table_load(pilot)
249
250 # Create mapper
251 mapper = TUITestMapper(pilot)
252
253 # Execute test case
254 await test_case.execute_in_tui(pilot, mapper)
255
256 # Wait for results
257 await pilot.pause()
258 await wait_for_table_load(pilot)
259
260 # Validate
261 success = test_case.validate_result(app)
262
263 if success:
264 print(f"✓ {test_case.name} passed")
265 else:
266 # Get actual columns for debugging
267 cols, _ = get_table_data(app)
268 print(f"✗ {test_case.name} failed - columns: {cols}")
269 raise AssertionError(f"Test {test_case.name} validation failed")
270
271
272# Generate individual test functions for pytest

Callers 3

test_funcFunction · 0.85
run_single_testFunction · 0.85

Calls 7

create_appMethod · 0.95
XtopTUIWrapperClass · 0.90
wait_for_table_loadFunction · 0.90
get_table_dataFunction · 0.90
TUITestMapperClass · 0.85
execute_in_tuiMethod · 0.80
validate_resultMethod · 0.80

Tested by

no test coverage detected