def test_api_forecast5_city_name(self):
     cityInfo1 = RandomCityChooser.getRandomCity()
     cityInfo2 = RandomCityChooser.getRandomCity()
     params = {"q": cityInfo1['name'], "appid": self.__appId}
     print("Running 5 day forecast test for city = %s" % cityInfo1['name'])
     response1 = self.invokeGetApi(url="/data/2.5/forecast", params=params)
     params = {"q": cityInfo2['name'], "appid": self.__appId}
     print("Running 5 day forecast test for city = %s" % cityInfo2['name'])
     response2 = self.invokeGetApi(url="/data/2.5/forecast", params=params)
 def test_api_call_zipcode(self):
     zipCode1 = RandomCityChooser.getRandomZip()['Zipcode']
     zipCode2 = RandomCityChooser.getRandomZip()['Zipcode']
     params = {"zip": zipCode1, "appid": self.__appId}
     print("Running 5 day forecast test for ZipCode = %s" % (zipCode1))
     response1 = self.invokeGetApi(url="/data/2.5/forecast", params=params)
     params = {"zip": zipCode2, "appid": self.__appId}
     print("Running 5 day forecast test for ZipCode = %s" % (zipCode2))
     response2 = self.invokeGetApi(url="/data/2.5/forecast", params=params)
示例#3
0
 def test_api_call_city(self):
     cityName1 = RandomCityChooser.getRandomCity()['name']
     cityName2 = RandomCityChooser.getRandomCity()['name']
     params = {"q": cityName1, "appid": self.__appId}
     print("Running test for city = %s" %cityName1)
     response1 = self.invokeGetApi("/data/2.5/weather", params=params)
     params = {"q": cityName2, "appid": self.__appId}
     print("Running test for city = %s" %cityName2)
     response2 = self.invokeGetApi("/data/2.5/weather", params=params)
示例#4
0
 def test_api_call_city_country(self):
     cityInfo1 = RandomCityChooser.getRandomCity()
     cityCountry1 = cityInfo1['name'] + "," + cityInfo1['country']
     cityInfo2 = RandomCityChooser.getRandomCity()
     cityCountry2 = cityInfo2['name'] + "," + cityInfo2['country']
     params = {"q": cityCountry1, "appid": self.__appId}
     print("Running test for city and country = %s" %cityCountry1)
     response1 = self.invokeGetApi(url='/data/2.5/weather', params=params)
     params = {"q": cityCountry2, "appid": self.__appId}
     print("Running test for city and country = %s" %cityCountry2)
     response2 = self.invokeGetApi(url='/data/2.5/weather', params=params)
 def test_api_call_latlong(self):
     cityInfo1 = RandomCityChooser.getRandomCity()
     cityInfo2 = RandomCityChooser.getRandomCity()
     citylong1 = cityInfo1['coord']['lon']
     cityLat1 = cityInfo1['coord']['lat']
     citylong2 = cityInfo2['coord']['lon']
     cityLat2 = cityInfo2['coord']['lat']
     params = {"lat": cityLat1, "lon": citylong1, "appid": self.__appId}
     print(
         "Running 5 day forecast test for Lattitude = %s and Longitude = %s"
         % (cityLat1, citylong1))
     response1 = self.invokeGetApi(url="/data/2.5/forecast", params=params)
     params = {"lat": cityLat2, "lon": citylong1, "appid": self.__appId}
     print(
         "Running 5 day forecast test for Lattitude = %s and Longitude = %s"
         % (cityLat2, citylong2))
     response2 = self.invokeGetApi(url="/data/2.5/forecast", params=params)
示例#6
0
 def test_api_call_zipcode(self):
     city1 = RandomCityChooser.getRandomZip()
     city2 = RandomCityChooser.getRandomZip()
     city1Name = city1['City']
     city2Name = city2['City']
     uiD = ReadTemperatureData()
     uiData = uiD.getCityData(city1Name,city2Name)
     zipCode1 = city1["Zipcode"]
     zipCode2 = city2["Zipcode"]
     params = {"zip": zipCode1, "appid": self.__appId}
     print("Running test for ZipCode = %s" %(zipCode1))
     response1 = self.invokeGetApi("/data/2.5/weather", params=params)
     params = {"zip": zipCode2, "appid": self.__appId}
     print("Running test for ZipCode = %s" %(zipCode2))
     response2 = self.invokeGetApi("/data/2.5/weather", params=params)
     assert str(uiData[0]['city']) == str(response1['name']).upper()
     assert str(uiData[1]['city']) == str(response2['name']).upper()
示例#7
0
 def test_api_call_latlong(self):
     cityInfo1 = RandomCityChooser.getRandomCity()
     citylong1 = cityInfo1['coord']['lon']
     cityLat1 = cityInfo1['coord']['lat']
     cityInfo2 = RandomCityChooser.getRandomCity()
     uiD = ReadTemperatureData()
     uiData = uiD.getCityData(cityInfo1['name'],cityInfo2['name'])
     citylong2 = cityInfo2['coord']['lon']
     cityLat2 = cityInfo2['coord']['lat']
     params = {"lat": cityLat1, "lon": citylong1, "appid": self.__appId}
     print("Running test for Lattitude = %s and Longitude = %s" %(cityLat1,citylong1))
     response1 = self.invokeGetApi("/data/2.5/weather", params=params)
     params = {"lat": cityLat2, "lon": citylong2, "appid": self.__appId}
     print("Running test for Lattitude = %s and Longitude = %s" %(cityLat1,citylong1))
     response2 = self.invokeGetApi("/data/2.5/weather", params=params)
     assert str(uiData[0]['city']) == str(response1['name']).upper()
     assert str(uiData[1]['city']) == str(response2['name']).upper()