mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
plugins/Misc/test.py: Correct a test and make a couple tests more robust.
This commit is contained in:
parent
48a5f2a4a9
commit
4de0a49489
@ -27,6 +27,8 @@
|
|||||||
# POSSIBILITY OF SUCH DAMAGE.
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
###
|
###
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
from supybot.test import *
|
from supybot.test import *
|
||||||
|
|
||||||
class MiscTestCase(ChannelPluginTestCase):
|
class MiscTestCase(ChannelPluginTestCase):
|
||||||
@ -172,9 +174,10 @@ class MiscTestCase(ChannelPluginTestCase):
|
|||||||
orig = tsConfig()
|
orig = tsConfig()
|
||||||
try:
|
try:
|
||||||
tsConfig.setValue(True)
|
tsConfig.setValue(True)
|
||||||
self.feedMsg('foo bar baz')
|
self.getMsg('foo bar baz')
|
||||||
self.assertRegexp('echo [last]',
|
chars = conf.supybot.reply.whenAddressedBy.chars()
|
||||||
'\[\d+:\d+:\d+\] foo bar baz')
|
chars = re.escape(chars)
|
||||||
|
self.assertRegexp('echo [last]', r'. [%s]foo bar baz' % chars)
|
||||||
finally:
|
finally:
|
||||||
tsConfig.setValue(orig)
|
tsConfig.setValue(orig)
|
||||||
|
|
||||||
@ -184,8 +187,10 @@ class MiscTestCase(ChannelPluginTestCase):
|
|||||||
try:
|
try:
|
||||||
nickConfig.setValue(True)
|
nickConfig.setValue(True)
|
||||||
self.feedMsg('foo bar baz')
|
self.feedMsg('foo bar baz')
|
||||||
|
chars = conf.supybot.reply.whenAddressedBy.chars()
|
||||||
|
chars = re.escape(chars)
|
||||||
self.assertRegexp('echo [last]',
|
self.assertRegexp('echo [last]',
|
||||||
'<%s> foo bar baz' % self.nick)
|
'<%s> [%s]foo bar baz' % (self.nick, chars))
|
||||||
finally:
|
finally:
|
||||||
nickConfig.setValue(orig)
|
nickConfig.setValue(orig)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user