Fixed bugs in these tests.

This commit is contained in:
Jeremy Fincher 2004-04-09 16:49:24 +00:00
parent ec0dd27960
commit 1f0e646ff3

View File

@ -36,12 +36,20 @@ import conf
class AdminTestCase(PluginTestCase, PluginDocumentation): class AdminTestCase(PluginTestCase, PluginDocumentation):
plugins = ('Admin',) plugins = ('Admin',)
def testChannels(self): def testChannels(self):
def getAfterJoinMessages():
m = self.irc.takeMsg()
self.assertEqual(m.command, 'MODE')
m = self.irc.takeMsg()
self.assertEqual(m.command, 'WHO')
self.assertRegexp('channels', 'not.*in any') self.assertRegexp('channels', 'not.*in any')
self.irc.feedMsg(ircmsgs.join('#foo', prefix=self.prefix)) self.irc.feedMsg(ircmsgs.join('#foo', prefix=self.prefix))
getAfterJoinMessages()
self.assertRegexp('channels', '#foo') self.assertRegexp('channels', '#foo')
self.irc.feedMsg(ircmsgs.join('#bar', prefix=self.prefix)) self.irc.feedMsg(ircmsgs.join('#bar', prefix=self.prefix))
getAfterJoinMessages()
self.assertRegexp('channels', '#bar and #foo') self.assertRegexp('channels', '#bar and #foo')
self.irc.feedMsg(ircmsgs.join('#Baz', prefix=self.prefix)) self.irc.feedMsg(ircmsgs.join('#Baz', prefix=self.prefix))
getAfterJoinMessages()
self.assertRegexp('channels', '#bar, #Baz, and #foo') self.assertRegexp('channels', '#bar, #Baz, and #foo')
def testIgnoreUnignore(self): def testIgnoreUnignore(self):
@ -100,18 +108,23 @@ class AdminTestCase(PluginTestCase, PluginDocumentation):
self.assertEqual(m.args[1], 'key2,key1') self.assertEqual(m.args[1], 'key2,key1')
def testPart(self): def testPart(self):
def getAfterJoinMessages():
m = self.irc.takeMsg()
self.assertEqual(m.command, 'MODE')
m = self.irc.takeMsg()
self.assertEqual(m.command, 'WHO')
self.assertError('part #foo') self.assertError('part #foo')
self.assertRegexp('part #foo', 'currently') self.assertRegexp('part #foo', 'currently')
_ = self.getMsg('join #foo') # get the JOIN. self.irc.feedMsg(ircmsgs.join('#foo', prefix=self.prefix))
_ = self.getMsg(' ') # get the WHO. getAfterJoinMessages()
self.assertError('part #foo #bar') self.assertError('part #foo #bar')
m = self.getMsg('part #foo') m = self.getMsg('part #foo')
self.assertEqual(m.command, 'PART') self.assertEqual(m.command, 'PART')
self.assertEqual(m.args[0], '#foo') self.assertEqual(m.args[0], '#foo')
_ = self.getMsg('join #foo #bar') # get the JOIN. self.irc.feedMsg(ircmsgs.join('#foo', prefix=self.prefix))
_ = self.getMsg(' ') # get the WHO. getAfterJoinMessages()
# vvv(won't send this because there was no server response.) self.irc.feedMsg(ircmsgs.join('#bar', prefix=self.prefix))
# _ = self.getMsg(' ') # get the WH0. getAfterJoinMessages()
m = self.getMsg('part #foo #bar') m = self.getMsg('part #foo #bar')
self.assertEqual(m.command, 'PART') self.assertEqual(m.command, 'PART')
self.assertEqual(m.args[0], '#foo,#bar') self.assertEqual(m.args[0], '#foo,#bar')