12
12
from httpx import HTTPError
13
13
14
14
from gvm .protocols .http .core .connector import HttpApiConnector
15
- from gvm .protocols .http .core import ContentType
15
+ from gvm .protocols .http .core . headers import ContentType
16
16
17
17
TEST_JSON_HEADERS = {
18
18
"content-type" : "application/json;charset=utf-8" ,
@@ -115,7 +115,7 @@ def test_new_session(self):
115
115
new_client = HttpApiConnector ._new_client ()
116
116
self .assertIsInstance (new_client , httpx .Client )
117
117
118
- @patch ("gvm.http.core.connector.HttpApiConnector._new_client" )
118
+ @patch ("gvm.protocols. http.core.connector.HttpApiConnector._new_client" )
119
119
def test_basic_init (self , new_client_mock : MagicMock ):
120
120
mock_client = new_client_mock .return_value = new_mock_client ()
121
121
@@ -125,7 +125,7 @@ def test_basic_init(self, new_client_mock: MagicMock):
125
125
new_client_mock .assert_called_once_with (None , None )
126
126
self .assertEqual ({}, mock_client .headers )
127
127
128
- @patch ("gvm.http.core.connector.HttpApiConnector._new_client" )
128
+ @patch ("gvm.protocols. http.core.connector.HttpApiConnector._new_client" )
129
129
def test_https_init (self , new_client_mock : MagicMock ):
130
130
mock_client = new_client_mock .return_value = new_mock_client ()
131
131
@@ -139,7 +139,7 @@ def test_https_init(self, new_client_mock: MagicMock):
139
139
new_client_mock .assert_called_once_with ("foo.crt" , "bar.key" )
140
140
self .assertEqual ({}, mock_client .headers )
141
141
142
- @patch ("gvm.http.core.connector.HttpApiConnector._new_client" )
142
+ @patch ("gvm.protocols. http.core.connector.HttpApiConnector._new_client" )
143
143
def test_update_headers (self , new_client_mock : MagicMock ):
144
144
mock_client = new_client_mock .return_value = new_mock_client ()
145
145
@@ -151,7 +151,7 @@ def test_update_headers(self, new_client_mock: MagicMock):
151
151
152
152
self .assertEqual ({"x-foo" : "bar" , "x-baz" : "123" }, mock_client .headers )
153
153
154
- @patch ("gvm.http.core.connector.HttpApiConnector._new_client" )
154
+ @patch ("gvm.protocols. http.core.connector.HttpApiConnector._new_client" )
155
155
def test_delete (self , new_client_mock : MagicMock ):
156
156
mock_client = new_client_mock .return_value = new_mock_client ()
157
157
@@ -176,7 +176,7 @@ def test_delete(self, new_client_mock: MagicMock):
176
176
headers = {"baz" : "456" },
177
177
)
178
178
179
- @patch ("gvm.http.core.connector.HttpApiConnector._new_client" )
179
+ @patch ("gvm.protocols. http.core.connector.HttpApiConnector._new_client" )
180
180
def test_minimal_delete (self , new_client_mock : MagicMock ):
181
181
mock_client = new_client_mock .return_value = new_mock_client ()
182
182
@@ -193,7 +193,7 @@ def test_minimal_delete(self, new_client_mock: MagicMock):
193
193
"https://localhost/foo" , params = None , headers = None
194
194
)
195
195
196
- @patch ("gvm.http.core.connector.HttpApiConnector._new_client" )
196
+ @patch ("gvm.protocols. http.core.connector.HttpApiConnector._new_client" )
197
197
def test_delete_raise_on_status (self , new_client_mock : MagicMock ):
198
198
mock_client = new_client_mock .return_value = new_mock_client ()
199
199
@@ -207,7 +207,7 @@ def test_delete_raise_on_status(self, new_client_mock: MagicMock):
207
207
"https://localhost/foo" , params = None , headers = None
208
208
)
209
209
210
- @patch ("gvm.http.core.connector.HttpApiConnector._new_client" )
210
+ @patch ("gvm.protocols. http.core.connector.HttpApiConnector._new_client" )
211
211
def test_delete_no_raise_on_status (self , new_client_mock : MagicMock ):
212
212
mock_client = new_client_mock .return_value = new_mock_client ()
213
213
@@ -237,7 +237,7 @@ def test_delete_no_raise_on_status(self, new_client_mock: MagicMock):
237
237
headers = {"baz" : "456" },
238
238
)
239
239
240
- @patch ("gvm.http.core.connector.HttpApiConnector._new_client" )
240
+ @patch ("gvm.protocols. http.core.connector.HttpApiConnector._new_client" )
241
241
def test_get (self , new_client_mock : MagicMock ):
242
242
mock_client = new_client_mock .return_value = new_mock_client ()
243
243
@@ -262,7 +262,7 @@ def test_get(self, new_client_mock: MagicMock):
262
262
headers = {"baz" : "456" },
263
263
)
264
264
265
- @patch ("gvm.http.core.connector.HttpApiConnector._new_client" )
265
+ @patch ("gvm.protocols. http.core.connector.HttpApiConnector._new_client" )
266
266
def test_minimal_get (self , new_client_mock : MagicMock ):
267
267
mock_client = new_client_mock .return_value = new_mock_client ()
268
268
@@ -279,7 +279,7 @@ def test_minimal_get(self, new_client_mock: MagicMock):
279
279
"https://localhost/foo" , params = None , headers = None
280
280
)
281
281
282
- @patch ("gvm.http.core.connector.HttpApiConnector._new_client" )
282
+ @patch ("gvm.protocols. http.core.connector.HttpApiConnector._new_client" )
283
283
def test_get_raise_on_status (self , new_client_mock : MagicMock ):
284
284
mock_client = new_client_mock .return_value = new_mock_client ()
285
285
@@ -293,7 +293,7 @@ def test_get_raise_on_status(self, new_client_mock: MagicMock):
293
293
"https://localhost/foo" , params = None , headers = None
294
294
)
295
295
296
- @patch ("gvm.http.core.connector.HttpApiConnector._new_client" )
296
+ @patch ("gvm.protocols. http.core.connector.HttpApiConnector._new_client" )
297
297
def test_get_no_raise_on_status (self , new_client_mock : MagicMock ):
298
298
mock_client = new_client_mock .return_value = new_mock_client ()
299
299
@@ -323,7 +323,7 @@ def test_get_no_raise_on_status(self, new_client_mock: MagicMock):
323
323
headers = {"baz" : "456" },
324
324
)
325
325
326
- @patch ("gvm.http.core.connector.HttpApiConnector._new_client" )
326
+ @patch ("gvm.protocols. http.core.connector.HttpApiConnector._new_client" )
327
327
def test_post_json (self , new_client_mock : MagicMock ):
328
328
mock_client = new_client_mock .return_value = new_mock_client ()
329
329
@@ -352,7 +352,7 @@ def test_post_json(self, new_client_mock: MagicMock):
352
352
headers = {"baz" : "456" },
353
353
)
354
354
355
- @patch ("gvm.http.core.connector.HttpApiConnector._new_client" )
355
+ @patch ("gvm.protocols. http.core.connector.HttpApiConnector._new_client" )
356
356
def test_minimal_post_json (self , new_client_mock : MagicMock ):
357
357
mock_client = new_client_mock .return_value = new_mock_client ()
358
358
@@ -372,7 +372,7 @@ def test_minimal_post_json(self, new_client_mock: MagicMock):
372
372
headers = None ,
373
373
)
374
374
375
- @patch ("gvm.http.core.connector.HttpApiConnector._new_client" )
375
+ @patch ("gvm.protocols. http.core.connector.HttpApiConnector._new_client" )
376
376
def test_post_json_raise_on_status (self , new_client_mock : MagicMock ):
377
377
mock_client = new_client_mock .return_value = new_mock_client ()
378
378
@@ -391,7 +391,7 @@ def test_post_json_raise_on_status(self, new_client_mock: MagicMock):
391
391
headers = None ,
392
392
)
393
393
394
- @patch ("gvm.http.core.connector.HttpApiConnector._new_client" )
394
+ @patch ("gvm.protocols. http.core.connector.HttpApiConnector._new_client" )
395
395
def test_post_json_no_raise_on_status (self , new_client_mock : MagicMock ):
396
396
mock_client = new_client_mock .return_value = new_mock_client ()
397
397
0 commit comments