コード例 #1
0
ファイル: test_tfw.py プロジェクト: vikramkashyap/phenny
 def setUp(self):
     if not is_up('https://nominatim.openstreetmap.org'):
         self.skipTest('OpenStreetMap API is down, skipping test.')
     if not is_up('http://tgftp.nws.noaa.gov'):
         self.skipTest('NOAA weather data unavailable, skipping test.')
     self.phenny = MagicMock()
     self.input = MagicMock()
コード例 #2
0
ファイル: test_clock.py プロジェクト: vikramkashyap/phenny
 def test_tock(self, mock_time):
     if not is_up('http://tycho.usno.navy.mil'):
         self.skipTest('US Military atomic clock server is down, skipping test.')
     tock(self.phenny, None)
     out = self.phenny.say.call_args[0][0]
     m = re.match('^.* - tycho.usno.navy.mil$',
             out, flags=re.UNICODE)
     self.assertTrue(m)
コード例 #3
0
ファイル: test_clock.py プロジェクト: vikramkashyap/phenny
 def test_npl(self, mock_time):
     if not is_up('http://npl.co.uk'):
         self.skipTest('NPL NTP server is down, skipping test.')
     npl(self.phenny, None)
     out = self.phenny.say.call_args[0][0]
     m = re.match('^.* - ntp1.npl.co.uk$',
             out, flags=re.UNICODE)
     self.assertTrue(m)
コード例 #4
0
ファイル: test_weather.py プロジェクト: vikramkashyap/phenny
 def setUp(self):
     for dom, name in [('https://nominatim.openstreetmap.org', 'Location'),
                       ('http://www.flightstats.com', 'Airport'),
                       ('http://tgftp.nws.noaa.gov', 'NOAA weather')]:
         if not is_up(dom):
             self.skipTest(
                 '{:s} data domain is down, skipping test.'.format(name))
     self.phenny = MagicMock()
     self.input = MagicMock()
コード例 #5
0
 def setUp(self):
     for url in [
             'https://webapps.middleware.vt.edu', 'http://search.vt.edu'
     ]:
         if not is_up(url):
             self.skipTest(
                 'One or more hokie domains are down, skipping test.')
     self.phenny = MagicMock()
     self.input = MagicMock()
コード例 #6
0
 def setUp(self):
     if not is_up('https://vtluug.org/wiki'):
         self.skipTest('VTLUUG wiki is down, skipping test.')
     self.phenny = MagicMock()
     self.input = MagicMock()
コード例 #7
0
ファイル: test_fcc.py プロジェクト: vikramkashyap/phenny
 def setUp(self):
     if not is_up('http://callook.info'):
         self.skipTest('FCC database server is down, skipping test.')
     self.phenny = MagicMock()
     self.input = MagicMock()
コード例 #8
0
ファイル: test_imdb.py プロジェクト: vikramkashyap/phenny
 def setUp(self):
     if not is_up('http://omdbapi.com'):
         self.skipTest('OMDb server is down, skipping test.')
     self.phenny = MagicMock()
     self.input = MagicMock()
コード例 #9
0
ファイル: test_calc.py プロジェクト: vikramkashyap/phenny
 def setUp(self):
     if not is_up('https://duckduckgo.com'):
         self.skipTest('DuckDuckGo is down, skipping test.')
     self.phenny = MagicMock()
     self.input = MagicMock()
コード例 #10
0
 def test_fml(self):
     if not is_up('http://fmylife.com/random'):
         self.skipTest('FML website is down, skipping test.')
     mylife.fml(self.phenny, None)
     self.assertTrue(self.phenny.say.called)
コード例 #11
0
 def test_duck(self):
     if not is_up(self.engines['DuckDuckGo']):
         self.skipTest(self.skip_msg.format('DuckDuckGo'))
     self.input.group.return_value = 'swhack'
     duck(self.phenny, self.input)
     self.assertTrue(self.phenny.reply.called)
コード例 #12
0
 def test_bing(self):
     if not is_up(self.engines['Bing']):
         self.skipTest(self.skip_msg.format('Bing'))
     self.input.group.return_value = 'swhack'
     bing(self.phenny, self.input)
     self.assertTrue(self.phenny.reply.called)
コード例 #13
0
 def test_gsearch(self):
     if not is_up(self.engines['Google']):
         self.skipTest(self.skip_msg.format('Google'))
     self.input.group.return_value = 'vtluug virginia phenny'
     gsearch(self.phenny, self.input)
     self.assertTrue(self.phenny.say.called)
コード例 #14
0
 def setUp(self):
     if not is_up('https://wiki.archlinux.org'):
         self.skipTest('ArchWiki is down, skipping test.')
     self.phenny = MagicMock()
     self.input = MagicMock()
コード例 #15
0
 def test_mlia(self):
     if not is_up('http://mylifeisaverage.com'):
         self.skipTest('MLIA website is down, skipping test.')
     mylife.mlia(self.phenny, None)
     self.assertTrue(self.phenny.say.called)
コード例 #16
0
 def setUp(self):
     if not is_up('http://rule34.xxx'):
         self.skipTest('Rule34 website is down, skipping test.')
     self.phenny = MagicMock()
     self.input = MagicMock()
コード例 #17
0
ファイル: test_lastfm.py プロジェクト: vikramkashyap/phenny
 def setUp(self):
     if not is_up('https://ws.audioscrobbler.com'):
         self.skipTest('LastFM server is down, skipping test.')
     self.phenny = MagicMock()
     self.input = MagicMock()
コード例 #18
0
 def setUp(self):
     if not is_up('https://en.wiktionary.org'):
         self.skipTest('Wiktionary is down, skipping test.')
     self.phenny = MagicMock()
     self.input = MagicMock()
コード例 #19
0
 def test_google_search(self):
     if not is_up(self.engines['Google']):
         self.skipTest(self.skip_msg.format('Google'))
     self.input.group.return_value = 'vtluug virginia phenny'
     results = google_search(self.input, my_api_key, my_cse_id)
     self.assertTrue(results)
コード例 #20
0
 def setUp(self):
     if not is_up('http://www.urbandictionary.com'):
         self.skipTest('UrbanDictionary is down, skipping test.')
     self.phenny = MagicMock()
     self.input = MagicMock()
コード例 #21
0
 def test_bing_search(self):
     if not is_up(self.engines['Bing']):
         self.skipTest(self.skip_msg.format('Bing'))
     out = bing_search('phenny')
     m = re.match('^https?://.*$', out, flags=re.UNICODE)
     self.assertTrue(m)
コード例 #22
0
 def setUp(self):
     if not is_up('https://www.wuvt.vt.edu'):
         self.skipTest('WUVT data is not available, skipping test.')
     self.phenny = MagicMock()
コード例 #23
0
 def test_duck_search(self):
     if not is_up(self.engines['DuckDuckGo']):
         self.skipTest(self.skip_msg.format('DuckDuckGo'))
     out = unquote(duck_search('phenny'))
     m = re.match(r'^https?://.*$', out, flags=re.UNICODE)
     self.assertTrue(m)
コード例 #24
0
ファイル: test_slogan.py プロジェクト: vikramkashyap/phenny
 def setUp(self):
     if not is_up('http://www.sloganizer.net'):
         self.skipTest('Sloganizer server is down, skipping test.')
     self.phenny = MagicMock()
     self.input = MagicMock()
コード例 #25
0
 def test_suggest(self):
     if not is_up(self.engines['Suggestion script']):
         self.skipTest(self.skip_msg.format('Suggestion script'))
     self.input.group.return_value = 'vtluug'
     suggest(self.phenny, self.input)
     self.assertTrue(self.phenny.reply.called or self.phenny.say.called)
コード例 #26
0
ファイル: test_commit.py プロジェクト: vikramkashyap/phenny
 def setUp(self):
     if not is_up('http://whatthecommit.com'):
         self.skipTest('\'What the Commit\' server is down, skipping test.')
     self.phenny = MagicMock()