mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 19:22:45 +01:00
Factoids: Prevent empty key or value when adding a factoid.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
(cherry picked from commit 10f5a12b7e
)
This commit is contained in:
parent
e13d3d6943
commit
0933621dab
@ -1,6 +1,6 @@
|
||||
###
|
||||
# Copyright (c) 2002-2005, Jeremiah Fincher
|
||||
# Copyright (c) 2009, James Vega
|
||||
# Copyright (c) 2009-2010, James Vega
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@ -63,6 +63,8 @@ def getFactoid(irc, msg, args, state):
|
||||
key.append(args.pop(0))
|
||||
else:
|
||||
value.append(args.pop(0))
|
||||
if not key or not value:
|
||||
raise callbacks.ArgumentError
|
||||
state.args.append(' '.join(key))
|
||||
state.args.append(' '.join(value))
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
###
|
||||
# Copyright (c) 2002-2005, Jeremiah Fincher
|
||||
# Copyright (c) 2010, James Vega
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@ -43,6 +44,8 @@ if sqlite:
|
||||
self.assertRegexp('random', 'primary author')
|
||||
|
||||
def testLearn(self):
|
||||
self.assertError('learn as my primary author')
|
||||
self.assertError('learn jemfinch as')
|
||||
self.assertNotError('learn jemfinch as my primary author')
|
||||
self.assertNotError('info jemfinch')
|
||||
self.assertRegexp('whatis jemfinch', 'my primary author')
|
||||
|
Loading…
Reference in New Issue
Block a user