mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-05-02 00:11:06 -05:00
Weather: more comprehensive tests
This commit is contained in:
parent
063f3e4800
commit
a6de04f08b
@ -1,8 +1,23 @@
|
||||
###
|
||||
# Copyright (c) 2012-2014, spline
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2018, James Lu <james@overdrivenetworks.com>
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
# this software and associated documentation files (the "Software"), to deal in
|
||||
# the Software without restriction, including without limitation the rights to
|
||||
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
# the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
# subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
###
|
||||
|
||||
from supybot.test import *
|
||||
@ -21,8 +36,29 @@ class WeatherTestCase(PluginTestCase):
|
||||
raise Exception(e)
|
||||
conf.supybot.plugins.Weather.apiKey.setValue(apiKey)
|
||||
|
||||
def testWeather(self):
|
||||
def testWeatherBasic(self):
|
||||
self.assertRegexp('weather New York City', 'New York, NY')
|
||||
self.assertError('weather InvalidLocationTestCasePleaseIgnore')
|
||||
|
||||
def testWeatherUSZIPCode(self):
|
||||
self.assertRegexp('weather 10002', 'New York, NY')
|
||||
|
||||
def testWeatherAmbiguous(self):
|
||||
# Returns Albany, NY last time I checked (2017-01-28)
|
||||
self.assertRegexp('weather New York', ', NY')
|
||||
# Alturas, CA (2017-01-28)
|
||||
self.assertRegexp('weather california', ', CA')
|
||||
# I'll be very upset if this returns the wrong one ;)
|
||||
self.assertRegexp('weather Vancouver', 'Vancouver, British Columbia')
|
||||
|
||||
def testWeatherAirport(self):
|
||||
# IATA codes (e.g. YVR, PEK, LAX for these 3) are unreliable and
|
||||
# sometimes clash with other places
|
||||
self.assertRegexp('weather CYVR', 'Vancouver International')
|
||||
self.assertRegexp('weather ZBAA', 'Beijing Capital')
|
||||
self.assertRegexp('weather KLAX', 'Los Angeles International')
|
||||
|
||||
def testWeatherSavesLocation(self):
|
||||
self.assertNotError('setweather 10002')
|
||||
self.assertNotError('setuser metric True')
|
||||
self.assertRegexp('weather', 'New York, NY')
|
||||
|
Loading…
x
Reference in New Issue
Block a user