@@ -389,39 +389,29 @@ def test_all_products(self) -> None:
389
389
assert output == expected
390
390
391
391
@respx .mock
392
- def test_404 (self ) -> None :
393
- # Arrange
394
- mocked_url = "https://endoflife.date/api/androd.json"
395
- respx .get (mocked_url ).respond (status_code = 404 )
396
-
397
- mocked_url = "https://endoflife.date/api/all.json"
398
- mocked_response = SAMPLE_RESPONSE_ALL_JSON
399
- respx .get (mocked_url ).respond (content = mocked_response )
400
-
401
- # Act / Assert
402
- with pytest .raises (
403
- ValueError ,
404
- match = r"Product 'androd' not found, run 'eol all' for list\. "
405
- r"Did you mean: 'android'?" ,
406
- ):
407
- norwegianblue .norwegianblue (product = "androd" )
408
-
409
- @respx .mock
410
- def test_404_no_suggestions (self ) -> None :
392
+ @pytest .mark .parametrize (
393
+ "product, expected" ,
394
+ [
395
+ (
396
+ "androd" ,
397
+ r"Product 'androd' not found, run 'eol all' for list\. "
398
+ r"Did you mean: 'android'?" ,
399
+ ),
400
+ ("julia" , r"Product 'julia' not found, run 'eol all' for list\." ),
401
+ ],
402
+ )
403
+ def test_404 (self , product , expected ) -> None :
411
404
# Arrange
412
- mocked_url = "https://endoflife.date/api/julia .json"
405
+ mocked_url = f "https://endoflife.date/api/{ product } .json"
413
406
respx .get (mocked_url ).respond (status_code = 404 )
414
407
415
408
mocked_url = "https://endoflife.date/api/all.json"
416
409
mocked_response = SAMPLE_RESPONSE_ALL_JSON
417
410
respx .get (mocked_url ).respond (content = mocked_response )
418
411
419
412
# Act / Assert
420
- with pytest .raises (
421
- ValueError ,
422
- match = r"Product 'julia' not found, run 'eol all' for list\." ,
423
- ):
424
- norwegianblue .norwegianblue (product = "julia" )
413
+ with pytest .raises (ValueError , match = expected ):
414
+ norwegianblue .norwegianblue (product = product )
425
415
426
416
def test_norwegianblue_norwegianblue (self ) -> None :
427
417
# Act
0 commit comments