Here is the unit test I have written:
@pytest.mark.parametrize('mock_finfo, mock_download_result',
[
({'ready': False},
None)
])
@mock.patch('jobserve.tasks.parsing_pipeline._pcontrol.pass1_parse')
@mock.patch('jobserve.tasks.parsing_pipeline.download_single_file_from_s3', return_value=None)
def test_parseable_files_pass1_force_False(mock_download_single_file_from_s3,
mock_pass1_parse, mock_finfo, download_result):
mock_parseable_files.return_value = mock_finfo
parser_code = 'lse'
data_file_group = 'equities2'
dte = 20190501
parser_extra_params = {'force': True}
try:
pass1(parser_code)
except ValueError as ve:
assert False, f"pass1 raised a ValueError {ve}"
In the above example, if I do not use mock_download_result anywhere in my code, however I want to run the test cases with potentially different inputs of mock_download_result. Is this the correct way to strucutre the unit test?