コード例 #1
0
ファイル: openweather_test.py プロジェクト: pennv/testing
 def test_check_no_input(self, send_request):
     send_request.return_value = self.harcoded_response(200)
     output_string = openweather.parse_result(
         send_request.return_value,
         argparse.Namespace(time=False,
                            pressure=False,
                            cloud=False,
                            humidity=False,
                            wind=False,
                            sunset=False,
                            sunrise=False,
                            temp=False))
     assert "Error: Add some feature!" in output_string, "This is not as expected. It is " + output_string
コード例 #2
0
ファイル: openweather_test.py プロジェクト: pennv/testing
 def test_check_time(self, send_request):
     send_request.return_value = self.harcoded_response(200)
     output_string = openweather.parse_result(
         send_request.return_value,
         argparse.Namespace(api='a61cbb04fbd6033b201358290286a8ed',
                            cid=None,
                            city='Melbourne',
                            cloud=False,
                            sunrise=False,
                            sunset=False,
                            temp=None,
                            time=True,
                            wind=False,
                            humidity=False,
                            pressure=None))
     assert "2019-10-12 02:00:00" in output_string, "Time is not as expected. It is " + output_string
コード例 #3
0
ファイル: openweather_test.py プロジェクト: pennv/testing
 def test_check_temp_fah(self, send_request):
     send_request.return_value = self.harcoded_response(200)
     output_string = openweather.parse_result(
         send_request.return_value,
         argparse.Namespace(api='a61cbb04fbd6033b201358290286a8ed',
                            cid=-1,
                            city='Melbourne',
                            cloud=False,
                            sunrise=False,
                            sunset=False,
                            temp='fahrenheit',
                            time=False,
                            wind=False,
                            humidity=False,
                            pressure=False))
     assert "ranges from 20 - 35" in output_string, "Temperature is not as expected. It is " + output_string
コード例 #4
0
ファイル: openweather_test.py プロジェクト: pennv/testing
 def test_check_wind(self, send_request):
     send_request.return_value = self.harcoded_response(200)
     output_string = openweather.parse_result(
         send_request.return_value,
         argparse.Namespace(api='a61cbb04fbd6033b201358290286a8ed',
                            cid=None,
                            city='Melbourne',
                            cloud=False,
                            sunrise=False,
                            sunset=False,
                            temp=False,
                            time=False,
                            wind=True,
                            humidity=False,
                            pressure=False))
     assert "Wind speed of 3 from 92.619 degrees" in output_string, "Wind is not as expected. It is " + output_string