Buckets:

download
raw
13 kB
"""Massive API Tests - Auto-generated."""
import pytest
from fastapi.testclient import TestClient
from api.auth import create_access_token
from api.main import app
client = TestClient(app)
@pytest.fixture
def auth_headers():
token = create_access_token({"sub": "test@example.com"})
return {"Authorization": f"Bearer {token}"}
def test_get__health_auth(auth_headers):
response = client.get("/health", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__health_noauth():
response = client.get("/health")
assert response.status_code in [200, 401, 403, 404]
def test_post__health(auth_headers):
response = client.post("/health", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]
def test_get__ready_auth(auth_headers):
response = client.get("/ready", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__ready_noauth():
response = client.get("/ready")
assert response.status_code in [200, 401, 403, 404]
def test_post__ready(auth_headers):
response = client.post("/ready", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]
def test_get__auth_login_auth(auth_headers):
response = client.get("/auth/login", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__auth_login_noauth():
response = client.get("/auth/login")
assert response.status_code in [200, 401, 403, 404]
def test_post__auth_login(auth_headers):
response = client.post("/auth/login", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]
def test_get__auth_register_auth(auth_headers):
response = client.get("/auth/register", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__auth_register_noauth():
response = client.get("/auth/register")
assert response.status_code in [200, 401, 403, 404]
def test_post__auth_register(auth_headers):
response = client.post("/auth/register", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]
def test_get__auth_refresh_auth(auth_headers):
response = client.get("/auth/refresh", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__auth_refresh_noauth():
response = client.get("/auth/refresh")
assert response.status_code in [200, 401, 403, 404]
def test_post__auth_refresh(auth_headers):
response = client.post("/auth/refresh", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]
def test_get__scans_auth(auth_headers):
response = client.get("/scans", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__scans_noauth():
response = client.get("/scans")
assert response.status_code in [200, 401, 403, 404]
def test_post__scans(auth_headers):
response = client.post("/scans", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]
def test_get__scans_1_auth(auth_headers):
response = client.get("/scans/1", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__scans_1_noauth():
response = client.get("/scans/1")
assert response.status_code in [200, 401, 403, 404]
def test_post__scans_1(auth_headers):
response = client.post("/scans/1", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]
def test_get__scans_1_start_auth(auth_headers):
response = client.get("/scans/1/start", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__scans_1_start_noauth():
response = client.get("/scans/1/start")
assert response.status_code in [200, 401, 403, 404]
def test_post__scans_1_start(auth_headers):
response = client.post("/scans/1/start", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]
def test_get__scans_1_stop_auth(auth_headers):
response = client.get("/scans/1/stop", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__scans_1_stop_noauth():
response = client.get("/scans/1/stop")
assert response.status_code in [200, 401, 403, 404]
def test_post__scans_1_stop(auth_headers):
response = client.post("/scans/1/stop", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]
def test_get__findings_auth(auth_headers):
response = client.get("/findings", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__findings_noauth():
response = client.get("/findings")
assert response.status_code in [200, 401, 403, 404]
def test_post__findings(auth_headers):
response = client.post("/findings", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]
def test_get__findings_1_auth(auth_headers):
response = client.get("/findings/1", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__findings_1_noauth():
response = client.get("/findings/1")
assert response.status_code in [200, 401, 403, 404]
def test_post__findings_1(auth_headers):
response = client.post("/findings/1", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]
def test_get__reports_auth(auth_headers):
response = client.get("/reports", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__reports_noauth():
response = client.get("/reports")
assert response.status_code in [200, 401, 403, 404]
def test_post__reports(auth_headers):
response = client.post("/reports", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]
def test_get__reports_1_auth(auth_headers):
response = client.get("/reports/1", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__reports_1_noauth():
response = client.get("/reports/1")
assert response.status_code in [200, 401, 403, 404]
def test_post__reports_1(auth_headers):
response = client.post("/reports/1", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]
def test_get__users_auth(auth_headers):
response = client.get("/users", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__users_noauth():
response = client.get("/users")
assert response.status_code in [200, 401, 403, 404]
def test_post__users(auth_headers):
response = client.post("/users", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]
def test_get__users_me_auth(auth_headers):
response = client.get("/users/me", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__users_me_noauth():
response = client.get("/users/me")
assert response.status_code in [200, 401, 403, 404]
def test_post__users_me(auth_headers):
response = client.post("/users/me", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]
def test_get__targets_auth(auth_headers):
response = client.get("/targets", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__targets_noauth():
response = client.get("/targets")
assert response.status_code in [200, 401, 403, 404]
def test_post__targets(auth_headers):
response = client.post("/targets", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]
def test_get__tools_auth(auth_headers):
response = client.get("/tools", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__tools_noauth():
response = client.get("/tools")
assert response.status_code in [200, 401, 403, 404]
def test_post__tools(auth_headers):
response = client.post("/tools", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]
def test_get__tools_execute_auth(auth_headers):
response = client.get("/tools/execute", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__tools_execute_noauth():
response = client.get("/tools/execute")
assert response.status_code in [200, 401, 403, 404]
def test_post__tools_execute(auth_headers):
response = client.post("/tools/execute", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]
def test_get__agents_auth(auth_headers):
response = client.get("/agents", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__agents_noauth():
response = client.get("/agents")
assert response.status_code in [200, 401, 403, 404]
def test_post__agents(auth_headers):
response = client.post("/agents", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]
def test_get__dashboard_stats_auth(auth_headers):
response = client.get("/dashboard/stats", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__dashboard_stats_noauth():
response = client.get("/dashboard/stats")
assert response.status_code in [200, 401, 403, 404]
def test_post__dashboard_stats(auth_headers):
response = client.post("/dashboard/stats", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]
def test_get__integrations_auth(auth_headers):
response = client.get("/integrations", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__integrations_noauth():
response = client.get("/integrations")
assert response.status_code in [200, 401, 403, 404]
def test_post__integrations(auth_headers):
response = client.post("/integrations", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]
def test_get__config_auth(auth_headers):
response = client.get("/config", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__config_noauth():
response = client.get("/config")
assert response.status_code in [200, 401, 403, 404]
def test_post__config(auth_headers):
response = client.post("/config", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]
def test_get__notifications_auth(auth_headers):
response = client.get("/notifications", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__notifications_noauth():
response = client.get("/notifications")
assert response.status_code in [200, 401, 403, 404]
def test_post__notifications(auth_headers):
response = client.post("/notifications", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]
def test_get__assets_auth(auth_headers):
response = client.get("/assets", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__assets_noauth():
response = client.get("/assets")
assert response.status_code in [200, 401, 403, 404]
def test_post__assets(auth_headers):
response = client.post("/assets", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]
def test_get__audit_logs_auth(auth_headers):
response = client.get("/audit-logs", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__audit_logs_noauth():
response = client.get("/audit-logs")
assert response.status_code in [200, 401, 403, 404]
def test_post__audit_logs(auth_headers):
response = client.post("/audit-logs", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]
def test_get__api_keys_auth(auth_headers):
response = client.get("/api-keys", headers=auth_headers)
assert response.status_code in [200, 401, 403, 404, 422]
def test_get__api_keys_noauth():
response = client.get("/api-keys")
assert response.status_code in [200, 401, 403, 404]
def test_post__api_keys(auth_headers):
response = client.post("/api-keys", json={}, headers=auth_headers)
assert response.status_code in [200, 201, 400, 401, 403, 404, 422]

Xet Storage Details

Size:
13 kB
·
Xet hash:
7d9429c660ac6ab2e10a62f04740197668147995f81a6da34f80b7bfd141ee1b

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.