#!/usr/bin/env python3
import requests
import urllib3
import re

# Disable SSL warnings for self-signed certificate
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

# Test configuration
base_url = "https://localhost:443"
admin_user = {"username": "rac00n", "password": "1248163264"}

def test_dashboard_detail():
    """Test dashboard content in detail"""
    session = requests.Session()
    
    # Login
    login_data = {
        "username": admin_user["username"],
        "password": admin_user["password"]
    }
    session.post(f"{base_url}/login", data=login_data, verify=False, allow_redirects=False)
    
    # Get dashboard
    response = session.get(f"{base_url}/", verify=False)
    content = response.text
    
    # Extract numbers from content
    numbers = re.findall(r'\d+', content)
    print(f"Numbers found on page: {numbers[:20]}")  # First 20 numbers
    
    # Check specific sections
    if "8" in numbers:  # Total customers
        print("✓ Found total customers count (8)")
    
    if "5" in numbers:  # Total licenses
        print("✓ Found total licenses count (5)")
    
    if "3" in numbers:  # Active licenses
        print("✓ Found active licenses count (3)")
    
    if "2" in numbers:  # Expired licenses
        print("✓ Found expired licenses count (2)")
    
    # Print a snippet of the HTML to see structure
    print("\nHTML snippet (first 1000 chars):")
    print(content[:1000])
    
    return response.status_code

print("Detailed Dashboard Test")
print("=" * 50)
status = test_dashboard_detail()