Skip to content

Commit

Permalink
DDG/PkgInfo: Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
James Lu committed Dec 12, 2014
1 parent 3a83539 commit f73028a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
3 changes: 3 additions & 0 deletions DDG/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,8 @@
class DDGTestCase(PluginTestCase):
plugins = ('DDG',)

def testSearch(self):
self.assertRegexp('ddg search wikipedia', 'Wikipedia.*? - .*?https?\:\/\/')


# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
35 changes: 24 additions & 11 deletions PkgInfo/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,46 +41,59 @@ def testPkgCommand(self):
' .*?')
self.assertError('pkg afdsfsadf asfasfasf')
self.assertRegexp('pkg sid afsadfasfsa', 'no such package', re.I)
except test.TimeoutError:
except AssertionError as e:
if "HTTP Error 50" in str(e) or "[Errno" in str(e): # It's not our fault; the API is down.
raise unittest.SkipTest("HTTP error 50x; the API's probably down again")
except TimeoutError:
raise unittest.SkipTest("Connection timed out.")

def testVlistCommandBasics(self):
self.assertError('vlist all afdsafas')
self.assertError('vlist invalid-distro firefox')
self.assertRegexp('vlist debian bash', 'Found [1-9][0-9]* results: (.*?\(.*?\))+')
self.assertRegexp('vlist debian bash --source', 'Found [1-9][0-9]* results: .*?: bash.*?\(.*?\).*?')
try:
self.assertError('vlist all afdsafas')
self.assertError('vlist invalid-distro firefox')
self.assertRegexp('vlist debian bash', 'Found [1-9][0-9]* results: (.*?\(.*?\))+')
self.assertRegexp('vlist debian bash --source', 'Found [1-9][0-9]* results: .*?: bash.*?\(.*?\).*?')
except AssertionError as e:
if "HTTP Error 50" in str(e) or "[Errno" in str(e): # It's not our fault; the API is down.
raise unittest.SkipTest("HTTP error 50x; the API's probably down again")

def testArchpkg(self):
self.assertError('archpkg afdsfbjeiog')
try:
self.assertNotError('archpkg bash')
self.assertRegexp('archpkg pacman --exact', 'Found 1.*?pacman -.*?')
except AssertionError as e:
if "HTTP Error 50" in str(e): # It's not our fault; the API is down.
if "HTTP Error 50" in str(e) or "[Errno" in str(e): # It's not our fault; the API is down.
raise unittest.SkipTest("HTTP error 50x; the API's probably down again")
except test.TimeoutError:
except TimeoutError:
raise unittest.SkipTest("Connection timed out.")

def testArchaur(self):
try:
self.assertError('archaur wjoitgjwotgjv')
self.assertRegexp('archaur yaourt', 'Found [1-9][0-9]* results: .*?yaourt.*?')
except AssertionError as e:
if "HTTP Error 50" in str(e): # It's not our fault; the API is down.
if "HTTP Error 50" in str(e) or "[Errno" in str(e): # It's not our fault; the API is down.
raise unittest.SkipTest("HTTP error 50x; the API's probably down again")
except test.TimeoutError:
except TimeoutError:
raise unittest.SkipTest("Connection timed out.")

def testMintPkg(self):
try:
self.assertNotError('mintpkg qiana cinnamon')
except test.TimeoutError:
except AssertionError as e:
if "HTTP Error 50" in str(e) or "[Errno" in str(e): # It's not our fault; the API is down.
raise unittest.SkipTest("HTTP error 50x; the API's probably down again")
except TimeoutError:
raise unittest.SkipTest("Connection timed out.")

def testPkgsearch(self):
try:
self.assertNotError('pkgsearch debian python')
except test.TimeoutError:
except AssertionError as e:
if "HTTP Error 50" in str(e) or "[Errno" in str(e): # It's not our fault; the API is down.
raise unittest.SkipTest("HTTP error 50x; the API's probably down again")
except TimeoutError:
raise unittest.SkipTest("Connection timed out.")

# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:

0 comments on commit f73028a

Please sign in to comment.