
import requests
import time
import subprocess
import os

# Start the server
proc = subprocess.Popen(['./venv/bin/python3', 'app.py'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
time.sleep(10) # Wait for server to start

try:
    print("Triggering bulk actions creation...")
    r = requests.post('http://127.0.0.1:5000/actions/bulk_create', data={'overwrite': 'true'})
    print(f"Actions status: {r.status_code}")
    
    print("Triggering bulk styles creation...")
    r = requests.post('http://127.0.0.1:5000/styles/bulk_create', data={'overwrite': 'true'})
    print(f"Styles status: {r.status_code}")
    
    print("Triggering bulk detailers creation...")
    r = requests.post('http://127.0.0.1:5000/detailers/bulk_create', data={'overwrite': 'true'})
    print(f"Detailers status: {r.status_code}")

finally:
    proc.terminate()
