from fastapi.testclient import TestClient from inference.app_production import app def run(): client = TestClient(app) # Ensure a clean test user email = 'test.user@example.com' password = 'TestPass123!' # Signup resp = client.post('/auth/signup', json={'email': email, 'password': password, 'name': 'Test User'}) if resp.status_code not in (200, 409): raise SystemExit(f'Signup failed: {resp.status_code} {resp.text}') # Login resp = client.post('/auth/login', json={'email': email, 'password': password}) if resp.status_code != 200: raise SystemExit(f'Login failed: {resp.status_code} {resp.text}') data = resp.json() token = data.get('token') if not token: raise SystemExit('No token returned on login') # Call /auth/me resp = client.get('/auth/me', headers={'Authorization': f'Bearer {token}'}) if resp.status_code != 200: raise SystemExit(f'/auth/me failed: {resp.status_code} {resp.text}') print('Auth smoke test passed') if __name__ == '__main__': run()