fix tests for head and weather

master
mutantmonkey 2016-03-06 14:40:11 -08:00
parent 2f34c76518
commit 23e9448c12
2 changed files with 9 additions and 8 deletions

View File

@ -22,20 +22,20 @@ class TestHead(unittest.TestCase):
self.assertTrue(m)
def test_head_404(self):
input = Mock(group=lambda x: 'http://vtluug.org/trigger_404')
input = Mock(group=lambda x: 'https://vtluug.org/trigger_404')
head(self.phenny, input)
out = self.phenny.say.call_args[0][0]
self.assertEqual(out, '404')
def test_header(self):
input = Mock(group=lambda x: 'http://vtluug.org Server')
input = Mock(group=lambda x: 'https://vtluug.org Server')
head(self.phenny, input)
self.phenny.say.assert_called_once_with("Server: nginx")
def test_header_bad(self):
input = Mock(group=lambda x: 'http://vtluug.org truncatedcone')
input = Mock(group=lambda x: 'https://vtluug.org truncatedcone')
head(self.phenny, input)
self.phenny.say.assert_called_once_with("There was no truncatedcone "\
@ -44,7 +44,7 @@ class TestHead(unittest.TestCase):
def test_snarfuri(self):
self.phenny.config.prefix = '.'
self.phenny.config.linx_api_key = ""
input = Mock(group=lambda x=0: 'http://google.com',
input = Mock(group=lambda x=0: 'https://www.google.com',
sender='#phenny')
snarfuri(self.phenny, input)

View File

@ -22,7 +22,6 @@ class TestWeather(unittest.TestCase):
return validate
locations = [
('24060', check_places("Blacksburg", "Virginia")),
('92121', check_places("San Diego", "California")),
('94110', check_places("San Francisco", "California")),
('94041', check_places("Mountain View", "California")),
@ -41,15 +40,17 @@ class TestWeather(unittest.TestCase):
("Berlin", check_places("Berlin", "Deutschland")),
("Paris", check_places("Paris", "France métropolitaine")),
("Vilnius", check_places("Vilnius", "Lietuva")),
('Blacksburg, VA', check_places("Blacksburg", "Virginia")),
]
for loc, validator in locations:
names, lat, lon = location(loc)
validator(names, lat, lon)
def test_code_20164(self):
icao = code(self.phenny, '20164')
self.assertEqual(icao, 'KIAD')
def test_code_94110(self):
icao = code(self.phenny, '94110')
self.assertEqual(icao, 'KSFO')
def test_airport(self):
input = Mock(group=lambda x: 'KIAD')