mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Fixed bug #846053.
This commit is contained in:
parent
0da5c27380
commit
308ae5527c
@ -42,6 +42,7 @@ import getopt
|
||||
import socket
|
||||
import urllib2
|
||||
|
||||
import SOAP
|
||||
import google
|
||||
|
||||
import conf
|
||||
@ -119,6 +120,9 @@ def search(*args, **kwargs):
|
||||
return 'Connection timed out to Google.com.'
|
||||
else:
|
||||
raise
|
||||
except SOAP.faultType, e:
|
||||
debug.msg(debug.exnToString(e))
|
||||
raise callbacks.Error, 'Invalid Google license key.'
|
||||
|
||||
class Google(callbacks.PrivmsgCommandAndRegexp, plugins.Configurable):
|
||||
threaded = True
|
||||
@ -168,6 +172,9 @@ class Google(callbacks.PrivmsgCommandAndRegexp, plugins.Configurable):
|
||||
is necessary before you can do any searching with this module.
|
||||
"""
|
||||
key = privmsgs.getArgs(args)
|
||||
if len(key) != 32:
|
||||
irc.error(msg, 'That doesn\'t seem to be a valid license key.')
|
||||
return
|
||||
google.setLicense(key)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
licensekey = privmsgs.checkCapability(licensekey, 'admin')
|
||||
|
@ -66,6 +66,12 @@ class GoogleTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||
'lr=lang_en&ie=UTF-8&oe=UTF-8&selm=698f09f8.'
|
||||
'0310132012.738e22fc%40posting.google.com')
|
||||
|
||||
def testInvalidKeyCaught(self):
|
||||
self.assertNotError(
|
||||
'google licensekey abcdefghijklmnopqrstuvwxyz123456')
|
||||
self.assertNotRegexp('google foobar', 'faultType')
|
||||
self.assertNotRegexp('google foobar', 'SOAP')
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user