17
17
"""Fixtures for cASO tests."""
18
18
19
19
import datetime
20
+ import typing
20
21
21
22
import pytest
22
23
239
240
240
241
241
242
@pytest .fixture (scope = "module" )
242
- def cloud_record ():
243
+ def cloud_record () -> caso . record . CloudRecord :
243
244
"""Get a fixture for the CloudRecord."""
244
245
record = caso .record .CloudRecord (** valid_cloud_records_fields [0 ])
245
246
# Remove this when moving to Pydantic 2
@@ -249,7 +250,7 @@ def cloud_record():
249
250
250
251
251
252
@pytest .fixture (scope = "module" )
252
- def another_cloud_record ():
253
+ def another_cloud_record () -> caso . record . CloudRecord :
253
254
"""Get another fixture for the CloudRecord."""
254
255
record = caso .record .CloudRecord (** valid_cloud_records_fields [1 ])
255
256
record .wall_duration = 432000
@@ -258,25 +259,27 @@ def another_cloud_record():
258
259
259
260
260
261
@pytest .fixture (scope = "module" )
261
- def valid_cloud_record ():
262
+ def valid_cloud_record () -> dict :
262
263
"""Get a fixture for a valid record."""
263
264
return valid_cloud_records_dict [0 ]
264
265
265
266
266
267
@pytest .fixture (scope = "module" )
267
- def valid_cloud_records ():
268
+ def valid_cloud_records () -> typing . List [ dict ] :
268
269
"""Get a fixture for valid records as a dict."""
269
270
return valid_cloud_records_dict
270
271
271
272
272
273
@pytest .fixture (scope = "module" )
273
- def another_valid_cloud_record ():
274
+ def another_valid_cloud_record () -> dict :
274
275
"""Get another fixture for a valid record as a dict."""
275
276
return valid_cloud_records_dict [0 ]
276
277
277
278
278
279
@pytest .fixture (scope = "module" )
279
- def cloud_record_list (cloud_record , another_cloud_record ):
280
+ def cloud_record_list (
281
+ cloud_record , another_cloud_record
282
+ ) -> typing .List [caso .record .CloudRecord ]:
280
283
"""Get a fixture for a list of valid records."""
281
284
return [cloud_record , another_cloud_record ]
282
285
@@ -285,39 +288,39 @@ def cloud_record_list(cloud_record, another_cloud_record):
285
288
286
289
287
290
@pytest .fixture (scope = "module" )
288
- def ip_record ():
291
+ def ip_record () -> caso . record . IPRecord :
289
292
"""Get a fixture for an IP record."""
290
293
record = caso .record .IPRecord (** valid_ip_records_fields [0 ])
291
294
return record
292
295
293
296
294
297
@pytest .fixture (scope = "module" )
295
- def another_ip_record ():
298
+ def another_ip_record () -> caso . record . IPRecord :
296
299
"""Get another fixture for an IP record."""
297
300
record = caso .record .IPRecord (** valid_ip_records_fields [1 ])
298
301
return record
299
302
300
303
301
304
@pytest .fixture (scope = "module" )
302
- def valid_ip_record ():
305
+ def valid_ip_record () -> dict :
303
306
"""Get a fixture for a valid IP record as a dict."""
304
307
return valid_ip_records_dict [0 ]
305
308
306
309
307
310
@pytest .fixture (scope = "module" )
308
- def valid_ip_records ():
311
+ def valid_ip_records () -> typing . List [ dict ] :
309
312
"""Get a fixture for all IP records as a dict."""
310
313
return valid_ip_records_dict
311
314
312
315
313
316
@pytest .fixture (scope = "module" )
314
- def another_valid_ip_record ():
317
+ def another_valid_ip_record () -> dict :
315
318
"""Get another fixture for an IP record as a dict."""
316
- return valid_ip_records_dict [0 ]
319
+ return valid_ip_records_dict [1 ]
317
320
318
321
319
322
@pytest .fixture (scope = "module" )
320
- def ip_record_list (ip_record , another_ip_record ):
323
+ def ip_record_list (ip_record , another_ip_record ) -> typing . List [ caso . record . IPRecord ] :
321
324
"""Get a fixture for a list of IP records."""
322
325
return [ip_record , another_ip_record ]
323
326
@@ -326,33 +329,35 @@ def ip_record_list(ip_record, another_ip_record):
326
329
327
330
328
331
@pytest .fixture (scope = "module" )
329
- def accelerator_record ():
332
+ def accelerator_record () -> caso . record . AcceleratorRecord :
330
333
"""Get a fixture for the AcceleratorRecord."""
331
334
record = caso .record .AcceleratorRecord (** valid_accelerator_records_fields [0 ])
332
335
return record
333
336
334
337
335
338
@pytest .fixture (scope = "module" )
336
- def another_accelerator_record ():
339
+ def another_accelerator_record () -> caso . record . AcceleratorRecord :
337
340
"""Get another fixture for the AcceleratorRecord."""
338
341
record = caso .record .AcceleratorRecord (** valid_accelerator_records_fields [1 ])
339
342
return record
340
343
341
344
342
345
@pytest .fixture (scope = "module" )
343
- def valid_accelerator_record ():
346
+ def valid_accelerator_record () -> dict :
344
347
"""Get a fixture for a valid record."""
345
348
return valid_accelerator_records_dict [0 ]
346
349
347
350
348
351
@pytest .fixture (scope = "module" )
349
- def valid_accelerator_records ():
352
+ def valid_accelerator_records () -> typing . List [ dict ] :
350
353
"""Get a fixture for valid records as a dict."""
351
354
return valid_accelerator_records_dict
352
355
353
356
354
357
@pytest .fixture (scope = "module" )
355
- def accelerator_record_list (accelerator_record , another_accelerator_record ):
358
+ def accelerator_record_list (
359
+ accelerator_record , another_accelerator_record
360
+ ) -> typing .List [caso .record .AcceleratorRecord ]:
356
361
"""Get a fixture for a list of Accelerator records."""
357
362
return [accelerator_record , another_accelerator_record ]
358
363
@@ -361,7 +366,7 @@ def accelerator_record_list(accelerator_record, another_accelerator_record):
361
366
362
367
363
368
@pytest .fixture
364
- def expected_entries_cloud ():
369
+ def expected_entries_cloud () -> typing . List [ str ] :
365
370
"""Get a fixture for all cloud entries."""
366
371
ssm_entries = [
367
372
"CloudComputeService: Fake Cloud Service\n "
@@ -408,7 +413,7 @@ def expected_entries_cloud():
408
413
409
414
410
415
@pytest .fixture
411
- def expected_message_cloud ():
416
+ def expected_message_cloud () -> str :
412
417
"""Get a fixture for a complete Cloud message."""
413
418
message = (
414
419
"APEL-cloud-message: v0.4\n "
@@ -436,7 +441,7 @@ def expected_message_cloud():
436
441
437
442
438
443
@pytest .fixture
439
- def expected_entries_ip ():
444
+ def expected_entries_ip () -> typing . List [ str ] :
440
445
"""Get a fixture for all IP entries."""
441
446
ssm_entries = [
442
447
'{"SiteName": "TEST-Site", '
@@ -466,7 +471,7 @@ def expected_entries_ip():
466
471
467
472
468
473
@pytest .fixture
469
- def expected_message_ip ():
474
+ def expected_message_ip () -> str :
470
475
"""Get a fixture for a complete IP message."""
471
476
message = (
472
477
'{"Type": "APEL Public IP message", "Version": "0.2", "UsageRecords": ['
@@ -498,7 +503,7 @@ def expected_message_ip():
498
503
499
504
500
505
@pytest .fixture
501
- def expected_entries_accelerator ():
506
+ def expected_entries_accelerator () -> typing . List [ str ] :
502
507
"""Get a fixture for all accelerator entries."""
503
508
ssm_entries = [
504
509
'{"SiteName": "TEST-Site", '
@@ -533,7 +538,7 @@ def expected_entries_accelerator():
533
538
534
539
535
540
@pytest .fixture
536
- def expected_message_accelerator ():
541
+ def expected_message_accelerator () -> str :
537
542
"""Get a fixture for a complete Accelerator message."""
538
543
message = (
539
544
'{"Type": "APEL-accelerator-message", "Version": "0.1", "UsageRecords": ['
0 commit comments