28
28
# Import BASE URL and TIMEOUT
29
29
API_URL = conf .API_URL
30
30
DATA_DIR = os .path .join (os .path .dirname (__file__ ), 'data' )
31
+ TIMEOUT = conf .TIMEOUT
32
+ VERIFICATION = conf .VERIFICATION
31
33
32
34
class TestLists :
33
35
"""Class which contains the unitary tests for lists module.
@@ -98,8 +100,9 @@ def test_parse_list(self):
98
100
url_series = ["nea_list" , "updated_nea" , "monthly_update" ]
99
101
for url in url_series :
100
102
# Get data from URL
101
- data_list = requests .get (API_URL + self .lists_dict [url ]).\
102
- content
103
+ data_list = requests .get (API_URL + self .lists_dict [url ],
104
+ timeout = TIMEOUT ,
105
+ verify = VERIFICATION ).content
103
106
# Decode the data using UTF-8
104
107
data_list_d = io .StringIO (data_list .decode ('utf-8' ))
105
108
@@ -113,8 +116,9 @@ def test_parse_list(self):
113
116
"impacted_objects" ]
114
117
for url in url_dfs :
115
118
# Get data from URL
116
- data_list = requests .get (API_URL + self .lists_dict [url ]).\
117
- content
119
+ data_list = requests .get (API_URL + self .lists_dict [url ],
120
+ timeout = TIMEOUT ,
121
+ verify = VERIFICATION ).content
118
122
# Decode the data using UTF-8
119
123
data_list_d = io .StringIO (data_list .decode ('utf-8' ))
120
124
@@ -134,8 +138,9 @@ def test_parse_nea(self):
134
138
url_series = ["nea_list" , "updated_nea" , "monthly_update" ]
135
139
for url in url_series :
136
140
# Get data from URL
137
- data_list = requests .get (API_URL + self .lists_dict [url ]).\
138
- content
141
+ data_list = requests .get (API_URL + self .lists_dict [url ],
142
+ timeout = TIMEOUT ,
143
+ verify = VERIFICATION ).content
139
144
# Decode the data using UTF-8
140
145
data_list_d = io .StringIO (data_list .decode ('utf-8' ))
141
146
# Parse using parse_nea
@@ -177,8 +182,9 @@ def test_parse_risk(self):
177
182
178
183
for url in url_risks :
179
184
# Get data from URL
180
- data_list = requests .get (API_URL + self .lists_dict [url ]).\
181
- content
185
+ data_list = requests .get (API_URL + self .lists_dict [url ],
186
+ timeout = TIMEOUT ,
187
+ verify = VERIFICATION ).content
182
188
# Decode the data using UTF-8
183
189
data_list_d = io .StringIO (data_list .decode ('utf-8' ))
184
190
# Parse using parse_nea
@@ -230,8 +236,9 @@ def test_parse_clo(self):
230
236
231
237
for url in url_close :
232
238
# Get data from URL
233
- data_list = requests .get (API_URL + self .lists_dict [url ]).\
234
- content
239
+ data_list = requests .get (API_URL + self .lists_dict [url ],
240
+ timeout = TIMEOUT ,
241
+ verify = VERIFICATION ).content
235
242
# Decode the data using UTF-8
236
243
data_list_d = io .StringIO (data_list .decode ('utf-8' ))
237
244
# Parse using parse_nea
@@ -280,8 +287,9 @@ def test_parse_pri(self):
280
287
281
288
for url in url_priority :
282
289
# Get data from URL
283
- data_list = requests .get (API_URL + self .lists_dict [url ]).\
284
- content
290
+ data_list = requests .get (API_URL + self .lists_dict [url ],
291
+ timeout = TIMEOUT ,
292
+ verify = VERIFICATION ).content
285
293
# Decode the data using UTF-8
286
294
data_list_d = io .StringIO (data_list .decode ('utf-8' ))
287
295
# Parse using parse_nea
@@ -322,8 +330,9 @@ def test_parse_encounter(self):
322
330
'Max Mag' ]
323
331
324
332
# Get data from URL
325
- data_list = requests .get (API_URL + self .lists_dict [url ]).\
326
- content
333
+ data_list = requests .get (API_URL + self .lists_dict [url ],
334
+ timeout = TIMEOUT ,
335
+ verify = VERIFICATION ).content
327
336
# Decode the data using UTF-8
328
337
data_list_d = io .StringIO (data_list .decode ('utf-8' ))
329
338
# Parse using parse_nea
@@ -360,8 +369,9 @@ def test_parse_impacted(self):
360
369
"""
361
370
url = 'impacted_objects'
362
371
# Get data from URL
363
- data_list = requests .get (API_URL + self .lists_dict [url ]).\
364
- content
372
+ data_list = requests .get (API_URL + self .lists_dict [url ],
373
+ timeout = TIMEOUT ,
374
+ verify = VERIFICATION ).content
365
375
# Decode the data using UTF-8
366
376
data_list_d = io .StringIO (data_list .decode ('utf-8' ))
367
377
# Parse using parse_nea
@@ -390,8 +400,9 @@ def test_parse_neo_catalogue(self):
390
400
'non-grav param.' ]
391
401
for url in url_cat :
392
402
# Get data from URL
393
- data_list = requests .get (API_URL + self .lists_dict [url ]).\
394
- content
403
+ data_list = requests .get (API_URL + self .lists_dict [url ],
404
+ timeout = TIMEOUT ,
405
+ verify = VERIFICATION ).content
395
406
# Decode the data using UTF-8
396
407
data_list_d = io .StringIO (data_list .decode ('utf-8' ))
397
408
# Parse using parse_nea
0 commit comments