-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_requests.py
More file actions
109 lines (75 loc) · 3.13 KB
/
test_requests.py
File metadata and controls
109 lines (75 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
"""Execute test requests against the Flask app to exercise the HTTPX instrumentation."""
from drift.instrumentation.e2e_common.test_utils import make_request, print_request_summary
if __name__ == "__main__":
print("Starting test request sequence for HTTPX instrumentation...\n")
# Health check
make_request("GET", "/health")
# ==========================================================================
# Sync Client Tests
# ==========================================================================
print("\n--- Sync Client Tests ---\n")
# Basic GET request - JSON response
make_request("GET", "/api/sync/get-json")
# GET with query parameters
make_request("GET", "/api/sync/get-with-params")
# GET with custom headers
make_request("GET", "/api/sync/get-with-headers")
# POST with JSON body
make_request(
"POST",
"/api/sync/post-json",
json={"title": "Sync Test Post", "body": "This is a sync test post body", "userId": 1},
)
# POST with form data
make_request("POST", "/api/sync/post-form")
# PUT request
make_request(
"PUT",
"/api/sync/put-json",
json={"title": "Sync Updated Post", "body": "This is a sync updated post body", "userId": 1},
)
# PATCH request
make_request("PATCH", "/api/sync/patch-json", json={"title": "Sync Patched Title"})
# DELETE request
make_request("DELETE", "/api/sync/delete")
# Sequential chained requests
make_request("GET", "/api/sync/chain")
# ==========================================================================
# Async Client Tests
# ==========================================================================
print("\n--- Async Client Tests ---\n")
# Async GET request - JSON response
make_request("GET", "/api/async/get-json")
# Async GET with query parameters
make_request("GET", "/api/async/get-with-params")
# Async POST with JSON body
make_request(
"POST",
"/api/async/post-json",
json={"title": "Async Test Post", "body": "This is an async test post body", "userId": 2},
)
# Async PUT request
make_request(
"PUT",
"/api/async/put-json",
json={"title": "Async Updated Post", "body": "This is an async updated post body", "userId": 2},
)
# Async DELETE request
make_request("DELETE", "/api/async/delete")
# Parallel async requests
make_request("GET", "/api/async/parallel")
# Async sequential chained requests
make_request("GET", "/api/async/chain")
make_request("GET", "/test/streaming")
make_request("GET", "/test/toplevel-stream")
make_request("POST", "/test/multipart-files")
make_request("GET", "/test/async-send")
make_request("GET", "/test/async-stream")
make_request("GET", "/test/follow-redirects")
make_request("GET", "/test/basic-auth")
make_request("GET", "/test/event-hooks")
make_request("GET", "/test/request-hook-modify-url")
make_request("GET", "/test/digest-auth")
make_request("GET", "/test/async-hooks")
make_request("POST", "/test/file-like-body")
print_request_summary()