mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 12:42:34 +01:00
Fix an exception when using the --to option for Note.list and add tests
for the --to and --from options.
This commit is contained in:
parent
06307abee1
commit
f31fec5681
@ -373,14 +373,9 @@ class Note(callbacks.Privmsg):
|
||||
def p(note):
|
||||
return note.frm == user.id
|
||||
if receiver:
|
||||
try:
|
||||
receiver = ircdb.users.getUserId(receiver)
|
||||
except KeyError:
|
||||
irc.error('That user is not in my user database.')
|
||||
return
|
||||
originalP = p
|
||||
def p(note):
|
||||
return originalP(note) and note.to == receiver
|
||||
return originalP(note) and note.to == receiver.id
|
||||
notes = list(self.db.select(p))
|
||||
if not notes:
|
||||
irc.error('I couldn\'t find any sent notes for your user.')
|
||||
|
@ -70,9 +70,11 @@ class NoteTestCase(PluginTestCase, PluginDocumentation):
|
||||
self.assertNotError('note send inkedmn 1,2,3')
|
||||
_ = self.getMsg(' ')
|
||||
self.assertRegexp('note list --sent', r'#2.*#1')
|
||||
self.assertRegexp('note list --sent --to inkedmn', r'#2.*#1')
|
||||
self.assertRegexp('note list', r'#1.*#2')
|
||||
self.assertRegexp('note 1', 'testing')
|
||||
self.assertResponse('note list --old', '#1 from inkedmn')
|
||||
self.assertResponse('note list --old --from inkedmn','#1 from inkedmn')
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user