mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Fixed a kernel bug which only happens when either one of the stable or beta
kernels isn't listed on the page and also fixed the geekquote tests to match the new behavior.
This commit is contained in:
parent
7ce4ab206c
commit
b995b2fd5c
@ -329,21 +329,13 @@ class Http(callbacks.Privmsg):
|
||||
|
||||
_mlgeekquotere = re.compile('<p class="qt">(.*?)</p>', re.M | re.DOTALL)
|
||||
def geekquote(self, irc, msg, args):
|
||||
"""[--id=<value>]
|
||||
"""[<id>]
|
||||
|
||||
Returns a random geek quote from bash.org; the optional argument
|
||||
--id specifies which quote to retrieve.
|
||||
id specifies which quote to retrieve.
|
||||
"""
|
||||
(optlist, rest) = getopt.getopt(args, '', ['id='])
|
||||
id = 'random1'
|
||||
for (option, arg) in optlist:
|
||||
if option == '--id':
|
||||
try:
|
||||
id = int(arg)
|
||||
except ValueError, e:
|
||||
irc.error(msg, 'Invalid id: %s' % e)
|
||||
return
|
||||
|
||||
id = privmsgs.getArgs(args, required=0, optional=1)
|
||||
id = id or 'random1'
|
||||
html = webutils.getUrl('http://bash.org/?%s' % id)
|
||||
m = self._mlgeekquotere.search(html)
|
||||
if m is None:
|
||||
@ -413,6 +405,8 @@ class Http(callbacks.Privmsg):
|
||||
except webutils.WebError, e:
|
||||
irc.error(msg, str(e))
|
||||
return
|
||||
stable = 'unknown'
|
||||
beta = 'unknown'
|
||||
for line in fd:
|
||||
(name, version) = line.split(':')
|
||||
if 'latest stable' in name:
|
||||
|
@ -84,8 +84,10 @@ class HttpTest(PluginTestCase, PluginDocumentation):
|
||||
|
||||
def testGeekquote(self):
|
||||
self.assertNotError('geekquote')
|
||||
self.assertNotError('geekquote --id=4848')
|
||||
self.assertError('geekquote --id=48a')
|
||||
self.assertNotError('geekquote 4848')
|
||||
# It's not an error, it just truncates at the first non-number
|
||||
#self.assertError('geekquote 48a8')
|
||||
self.assertError('geekquote asdf')
|
||||
|
||||
def testAcronym(self):
|
||||
self.assertRegexp('acronym ASAP', 'as soon as possible')
|
||||
|
Loading…
Reference in New Issue
Block a user