def test_output_format_weather(self):
     date = "2020-05-25"
     response = api_calls.get_weather(date)
     articleFileds = ["columns", "locations"]
     result = True
     for (keys, fields) in zip(response, articleFileds):
         if not keys in articleFileds:
             result = False
         if not fields in response:
             result = False
     self.assertTrue(result, "wrong format")
Example #2
0
def weather(date):
    return jsonify(api_calls.get_weather(date))
 def test_early_date_weather(self):
     date = "1900-02-10"
     response = api_calls.get_weather(date)
     self.assertEqual(response[0], "Please give a valid date.",
                      "Early date control failed")
 def test_forward_date_weather(self):
     date = "2022-08-18"
     response = api_calls.get_weather(date)
     self.assertEqual(response[0], "Please give a valid date.",
                      "Late date control failed")
 def test_input_format_weather(self):
     date = "1234567890"
     response = api_calls.get_weather(date)
     self.assertEqual(response[0], "Wrong input format",
                      "Input format test failed")