mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-18 14:40:51 +01:00
Fixed bug #846053.
This commit is contained in:
parent
0da5c27380
commit
308ae5527c
@ -42,6 +42,7 @@ import getopt
|
|||||||
import socket
|
import socket
|
||||||
import urllib2
|
import urllib2
|
||||||
|
|
||||||
|
import SOAP
|
||||||
import google
|
import google
|
||||||
|
|
||||||
import conf
|
import conf
|
||||||
@ -119,6 +120,9 @@ def search(*args, **kwargs):
|
|||||||
return 'Connection timed out to Google.com.'
|
return 'Connection timed out to Google.com.'
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
except SOAP.faultType, e:
|
||||||
|
debug.msg(debug.exnToString(e))
|
||||||
|
raise callbacks.Error, 'Invalid Google license key.'
|
||||||
|
|
||||||
class Google(callbacks.PrivmsgCommandAndRegexp, plugins.Configurable):
|
class Google(callbacks.PrivmsgCommandAndRegexp, plugins.Configurable):
|
||||||
threaded = True
|
threaded = True
|
||||||
@ -168,6 +172,9 @@ class Google(callbacks.PrivmsgCommandAndRegexp, plugins.Configurable):
|
|||||||
is necessary before you can do any searching with this module.
|
is necessary before you can do any searching with this module.
|
||||||
"""
|
"""
|
||||||
key = privmsgs.getArgs(args)
|
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)
|
google.setLicense(key)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.reply(msg, conf.replySuccess)
|
||||||
licensekey = privmsgs.checkCapability(licensekey, 'admin')
|
licensekey = privmsgs.checkCapability(licensekey, 'admin')
|
||||||
|
@ -66,6 +66,12 @@ class GoogleTestCase(ChannelPluginTestCase, PluginDocumentation):
|
|||||||
'lr=lang_en&ie=UTF-8&oe=UTF-8&selm=698f09f8.'
|
'lr=lang_en&ie=UTF-8&oe=UTF-8&selm=698f09f8.'
|
||||||
'0310132012.738e22fc%40posting.google.com')
|
'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:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user