Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /SHAdd0WTAka_Zen-Ai-Pentest /tests /load /locustfile.py
| """ | |
| Locust Load Testing for Zen AI Pentest API | |
| """ | |
| import random | |
| from locust import HttpUser, between, task | |
| class APIUser(HttpUser): | |
| """Simulated API user""" | |
| wait_time = between(1, 5) | |
| def on_start(self): | |
| """Called when a user starts""" | |
| # Login and get token | |
| response = self.client.post( | |
| "/api/v1/auth/login", | |
| json={"username": "admin", "password": "admin"}, | |
| ) | |
| if response.status_code == 200: | |
| self.token = response.json().get("access_token") | |
| else: | |
| self.token = None | |
| def get_health(self): | |
| """Test health endpoint""" | |
| self.client.get("/api/v1/health") | |
| def get_tools(self): | |
| """Test tools endpoint""" | |
| self.client.get("/api/v1/tools/") | |
| def get_stats(self): | |
| """Test stats endpoint""" | |
| self.client.get("/api/v1/stats/overview") | |
| def create_scan(self): | |
| """Test scan creation""" | |
| if self.token: | |
| headers = {"Authorization": f"Bearer {self.token}"} | |
| self.client.post( | |
| "/api/v1/scans/", | |
| json={ | |
| "name": f"Load Test Scan {random.randint(1, 1000)}", | |
| "target": "example.com", | |
| "scan_type": "basic", | |
| }, | |
| headers=headers, | |
| ) | |
| class FrontendUser(HttpUser): | |
| """Simulated frontend user""" | |
| wait_time = between(2, 10) | |
| def load_dashboard(self): | |
| """Test dashboard loading""" | |
| self.client.get("/") | |
| def load_scans_page(self): | |
| """Test scans page loading""" | |
| self.client.get("/scans") | |
| def load_findings_page(self): | |
| """Test findings page loading""" | |
| self.client.get("/findings") | |
Xet Storage Details
- Size:
- 1.86 kB
- Xet hash:
- ba8e5c4aca893791045fd2d93a1d5bef355b5a02a4b95be4b795e66384adcf53
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.