8
8
import pytest
9
9
import requests
10
10
11
- from nephthys .clients .requests_session import (
11
+ from nephthys .clients .requests import (
12
12
catch_logger_exception ,
13
13
decorate_log_request ,
14
14
decorate_log_response ,
15
- NephthysSession )
15
+ Session )
16
16
from nephthys .filters .requests import BODY_NOT_LOGGABLE
17
17
18
18
@@ -127,7 +127,7 @@ def test_send_log_record(caplog, m):
127
127
caplog .set_level (logging .INFO )
128
128
m .get ("https://ovalmoney.com/user" , status_code = 200 )
129
129
130
- s = NephthysSession ()
130
+ s = Session ()
131
131
s ._logger .info = MagicMock ()
132
132
s .get ("https://ovalmoney.com/user" )
133
133
@@ -138,7 +138,7 @@ def test_send_log_record_exception(caplog, m):
138
138
caplog .set_level (logging .INFO )
139
139
m .get ("https://ovalmoney.com/user" , exc = requests .exceptions .ConnectTimeout )
140
140
141
- s = NephthysSession ()
141
+ s = Session ()
142
142
s ._logger .exception = MagicMock ()
143
143
with pytest .raises (requests .exceptions .ConnectTimeout ):
144
144
s .get ("https://ovalmoney.com/user" )
@@ -154,7 +154,7 @@ def test_raw_data_reponse_log(caplog, m):
154
154
content = b"\xFF \x8F " ,
155
155
)
156
156
157
- s = NephthysSession ()
157
+ s = Session ()
158
158
s .get ("https://ovalmoney.com/raw_data" )
159
159
160
160
log_rec = [rec for rec in caplog .records ][0 ]
@@ -168,7 +168,7 @@ def test_raw_data_request_log(caplog, m):
168
168
caplog .set_level (logging .INFO )
169
169
m .post ("https://ovalmoney.com/raw_data" )
170
170
171
- s = NephthysSession ()
171
+ s = Session ()
172
172
s .post ("https://ovalmoney.com/raw_data" , headers = {"Content-Type" : "video" }, data = b"\xFF \x8F " )
173
173
174
174
log_rec = [rec for rec in caplog .records ][0 ]
@@ -181,7 +181,7 @@ def test_raw_data_request_log(caplog, m):
181
181
def test_session_fail_http (m ):
182
182
m .get ("https://ovalmoney.com/user" , exc = requests .exceptions .ConnectTimeout )
183
183
184
- s = NephthysSession ()
184
+ s = Session ()
185
185
with pytest .raises (requests .exceptions .ConnectTimeout ):
186
186
s .get ("https://ovalmoney.com/user" )
187
187
@@ -190,7 +190,7 @@ def test_session_fail_http_log(caplog, m):
190
190
caplog .set_level (logging .INFO )
191
191
m .get ("https://ovalmoney.com/user" , exc = requests .exceptions .ConnectTimeout )
192
192
193
- s = NephthysSession ()
193
+ s = Session ()
194
194
with pytest .raises (requests .exceptions .ConnectTimeout ):
195
195
s .get ("https://ovalmoney.com/user" )
196
196
@@ -213,7 +213,7 @@ def test_session_success(caplog, m):
213
213
status_code = 200 ,
214
214
)
215
215
216
- s = NephthysSession ()
216
+ s = Session ()
217
217
response = s .get ("https://ovalmoney.com/user" , params = {"key1" : "value1" , "key2" : ["value2" , "value3" ]})
218
218
219
219
assert response .headers
@@ -231,7 +231,7 @@ def test_session_success_log(caplog, m):
231
231
)
232
232
233
233
with freeze_time (datetime .utcnow ()):
234
- s = NephthysSession (log_tag = "test" )
234
+ s = Session (log_tag = "test" )
235
235
s .get ("https://ovalmoney.com/user" , params = {"key1" : "value1" , "key2" : ["value2" , "value3" ]})
236
236
now = datetime .utcnow ().timestamp ()
237
237
0 commit comments