def test_client_food_report_v2_warning(self, apimock): cli = UsdaClient("API_KAY") with apimock: with pytest.warns(UserWarning, match='received a basic report'): fr = cli.get_food_report_v2( 123456, report_type=UsdaNdbReportType.full, ) assert fr[0].food.name == "Pizza" assert fr[0].report_type == UsdaNdbReportType.basic
def test_client_food_report_v2_error(self, apimock): cli = UsdaClient("API_KAY") with apimock: with pytest.raises(DataGovApiError): cli.get_food_report_v2(666)
def test_client_food_report_v2(self, apimock): cli = UsdaClient("API_KAY") with apimock: fr = cli.get_food_report_v2(123456) assert fr[0].food.name == "Pizza"