def test_standardize_api_response_invalid_result_key(): fake_controller = lambda *args, **kwargs: {'invalid': ''} # noqa with pytest.raises(ValueError) as error: helpers.standardize_api_response(fake_controller)('foo') assert str(error.value) == 'Invalid result key.'
def test_standardize_api_response_valid_result_key(function, expected): result = helpers.standardize_api_response(function)(response='foo') assert result == expected