Add comprehensive test suites for security fixes and features

- test_atomic_settings.py: Atomic write operation tests
- test_csv_quoting.py: CSV QUOTE_MINIMAL protection tests
- test_complete_csv_sanitization.py: Full field sanitization tests
- test_input_sanitization.py: Input validation and security tests
- test_alternating_colors.py: Visual enhancement tests
- test_mark_billed.py & test_mark_logic.py: Existing functionality tests

All tests passing with comprehensive security coverage.
This commit is contained in:
2025-10-29 17:24:15 -04:00
parent 595875ca07
commit a564d430f8
7 changed files with 1122 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
#!/usr/bin/env python3
# Test script to verify the alternating color logic for time cells
def test_alternating_colors():
"""Test the color calculation logic for different hours"""
# Simulate the color logic from ClickableCell
def calculate_default_bg(col_idx, start_hour=9):
"""Calculate background color based on column index and start hour"""
hour_offset = col_idx // 4 # 4 cells per hour (15-minute intervals)
current_hour = start_hour + hour_offset
if current_hour % 2 == 0:
return "#e8e8e8" # Medium gray for even hours
else:
return "#f5f5f5" # Light gray for odd hours
print("Testing alternating colors for 8-hour work day (9 AM - 5 PM):")
print("=" * 60)
# Test for a typical work day (8 hours, 32 fifteen-minute slots)
start_hour = 9
time_slots = 8 * 4 # 8 hours × 4 slots per hour
for col_idx in range(time_slots):
hour_offset = col_idx // 4
current_hour = start_hour + hour_offset
quarter = (col_idx % 4) * 15 # 0, 15, 30, 45 minutes
color = calculate_default_bg(col_idx, start_hour)
# Show transition to new hour
if col_idx % 4 == 0:
print(f"\n{current_hour:02d}:00 - {current_hour:02d}:15 | Slot {col_idx:2d} | {color}")
else:
print(f" :{quarter:02d} | Slot {col_idx:2d} | {color}")
print("\nColor pattern should show:")
print("- 9:00-10:00: #f5f5f5 (odd hour)")
print("- 10:00-11:00: #e8e8e8 (even hour)")
print("- 11:00-12:00: #f5f5f5 (odd hour)")
print("- 12:00-13:00: #e8e8e8 (even hour)")
print("- 13:00-14:00: #f5f5f5 (odd hour)")
print("- 14:00-15:00: #e8e8e8 (even hour)")
print("- 15:00-16:00: #f5f5f5 (odd hour)")
print("- 16:00-17:00: #e8e8e8 (even hour)")
if __name__ == "__main__":
test_alternating_colors()