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

Function test_column_visibility

xtop/tests/test_column_visibility.py:12–63  ·  view source on GitHub ↗

Test that columns remain visible after filtering

()

Source from the content-addressed store, hash-verified

10from core import NavigationState
11
12def test_column_visibility():
13 """Test that columns remain visible after filtering"""
14
15 # Create navigation state
16 nav = NavigationState()
17 initial_cols = ['STATE', 'USERNAME', 'EXE', 'COMM', 'SYSCALL', 'FILENAME']
18 nav.reset("top", initial_cols)
19
20 print("Column Visibility Test")
21 print("=" * 60)
22
23 # Initial state
24 print("\n1. Initial state:")
25 print(f" Group columns: {nav.get_current_group_cols()}")
26 print(f" Filters: {nav.get_filter_display()}")
27 print(f" Where clause: {nav.get_current_where_clause()}")
28
29 # Filter by USERNAME
30 print("\n2. Press ENTER on USERNAME=postgres:")
31 nav.drill_down("USERNAME", "postgres")
32 print(f" Group columns: {nav.get_current_group_cols()}")
33 print(f" Filters: {nav.get_filter_display()}")
34 print(f" Where clause: {nav.get_current_where_clause()}")
35
36 # Check if USERNAME is still in group columns
37 if "USERNAME" in nav.get_current_group_cols():
38 print(" ✓ USERNAME column remains visible")
39 else:
40 print(" ✗ USERNAME column was hidden (BUG)")
41
42 # Filter by another column
43 print("\n3. Press ENTER on SYSCALL=pread64:")
44 nav.drill_down("SYSCALL", "pread64")
45 print(f" Group columns: {nav.get_current_group_cols()}")
46 print(f" Filters: {nav.get_filter_display()}")
47 print(f" Where clause: {nav.get_current_where_clause()}")
48
49 # Check both columns are still visible
50 visible_count = 0
51 for col in ["USERNAME", "SYSCALL"]:
52 if col in nav.get_current_group_cols():
53 print(f" ✓ {col} column remains visible")
54 visible_count += 1
55 else:
56 print(f" ✗ {col} column was hidden")
57
58 print("\n" + "=" * 60)
59 print("Summary:")
60 print("- Filtered columns should remain visible in the table")
61 print("- They will show the same value for all rows (the filtered value)")
62 print("- This helps users understand what filters are active")
63 print(f"- Filter breadcrumb shows: {nav.get_filter_display()}")
64
65if __name__ == "__main__":
66 test_column_visibility()

Callers 1

Calls 6

resetMethod · 0.95
get_filter_displayMethod · 0.95
drill_downMethod · 0.95
NavigationStateClass · 0.90

Tested by

no test coverage detected