Exemple #1
0
 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
Exemple #2
0
 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)
Exemple #3
0
 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"