35
35
36
36
37
37
class TestURLLib3Instrumentor (TestBase ):
38
- HTTP_URL = "http://httpbin.org /status/200"
39
- HTTPS_URL = "https://httpbin.org /status/200"
38
+ HTTP_URL = "http://mock /status/200"
39
+ HTTPS_URL = "https://mock /status/200"
40
40
41
41
def setUp (self ):
42
42
super ().setUp ()
@@ -123,7 +123,7 @@ def test_basic_http_success(self):
123
123
self .assert_success_span (response , self .HTTP_URL )
124
124
125
125
def test_basic_http_success_using_connection_pool (self ):
126
- pool = urllib3 .HTTPConnectionPool ("httpbin.org " )
126
+ pool = urllib3 .HTTPConnectionPool ("mock " )
127
127
response = pool .request ("GET" , "/status/200" )
128
128
129
129
self .assert_success_span (response , self .HTTP_URL )
@@ -133,13 +133,13 @@ def test_basic_https_success(self):
133
133
self .assert_success_span (response , self .HTTPS_URL )
134
134
135
135
def test_basic_https_success_using_connection_pool (self ):
136
- pool = urllib3 .HTTPSConnectionPool ("httpbin.org " )
136
+ pool = urllib3 .HTTPSConnectionPool ("mock " )
137
137
response = pool .request ("GET" , "/status/200" )
138
138
139
139
self .assert_success_span (response , self .HTTPS_URL )
140
140
141
141
def test_basic_not_found (self ):
142
- url_404 = "http://httpbin.org /status/404"
142
+ url_404 = "http://mock /status/404"
143
143
httpretty .register_uri (httpretty .GET , url_404 , status = 404 )
144
144
145
145
response = self .perform_request (url_404 )
@@ -152,30 +152,30 @@ def test_basic_not_found(self):
152
152
self .assertIs (trace .status .StatusCode .ERROR , span .status .status_code )
153
153
154
154
def test_basic_http_non_default_port (self ):
155
- url = "http://httpbin.org :666/status/200"
155
+ url = "http://mock :666/status/200"
156
156
httpretty .register_uri (httpretty .GET , url , body = "Hello!" )
157
157
158
158
response = self .perform_request (url )
159
159
self .assert_success_span (response , url )
160
160
161
161
def test_basic_http_absolute_url (self ):
162
- url = "http://httpbin.org :666/status/200"
162
+ url = "http://mock :666/status/200"
163
163
httpretty .register_uri (httpretty .GET , url , body = "Hello!" )
164
- pool = urllib3 .HTTPConnectionPool ("httpbin.org " , port = 666 )
164
+ pool = urllib3 .HTTPConnectionPool ("mock " , port = 666 )
165
165
response = pool .request ("GET" , url )
166
166
167
167
self .assert_success_span (response , url )
168
168
169
169
def test_url_open_explicit_arg_parameters (self ):
170
- url = "http://httpbin.org :666/status/200"
170
+ url = "http://mock :666/status/200"
171
171
httpretty .register_uri (httpretty .GET , url , body = "Hello!" )
172
- pool = urllib3 .HTTPConnectionPool ("httpbin.org " , port = 666 )
172
+ pool = urllib3 .HTTPConnectionPool ("mock " , port = 666 )
173
173
response = pool .urlopen (method = "GET" , url = "/status/200" )
174
174
175
175
self .assert_success_span (response , url )
176
176
177
177
def test_excluded_urls_explicit (self ):
178
- url_201 = "http://httpbin.org /status/201"
178
+ url_201 = "http://mock /status/201"
179
179
httpretty .register_uri (
180
180
httpretty .GET ,
181
181
url_201 ,
@@ -301,7 +301,7 @@ def url_filter(url):
301
301
self .assert_success_span (response , self .HTTP_URL )
302
302
303
303
def test_credential_removal (self ):
304
- url = "http://username:password@httpbin.org /status/200"
304
+ url = "http://username:password@mock /status/200"
305
305
306
306
response = self .perform_request (url )
307
307
self .assert_success_span (response , self .HTTP_URL )
@@ -339,7 +339,7 @@ def request_hook(span, request, headers, body):
339
339
headers = {"header1" : "value1" , "header2" : "value2" }
340
340
body = "param1=1¶m2=2"
341
341
342
- pool = urllib3 .HTTPConnectionPool ("httpbin.org " )
342
+ pool = urllib3 .HTTPConnectionPool ("mock " )
343
343
response = pool .request (
344
344
"POST" , "/status/200" , body = body , headers = headers
345
345
)
@@ -366,7 +366,7 @@ def request_hook(span, request, headers, body):
366
366
367
367
body = "param1=1¶m2=2"
368
368
369
- pool = urllib3 .HTTPConnectionPool ("httpbin.org " )
369
+ pool = urllib3 .HTTPConnectionPool ("mock " )
370
370
response = pool .urlopen ("POST" , "/status/200" , body )
371
371
372
372
self .assertEqual (b"Hello!" , response .data )
0 commit comments