mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-10 12:59:22 +01:00
Merge pull request #1228 from GLolol/ircutils-1
ircutils: add $network to standard substitutions
This commit is contained in:
commit
e91b3e70f8
@ -824,6 +824,7 @@ def standardSubstitute(irc, msg, text, env=None):
|
||||
if irc:
|
||||
vars.update({
|
||||
'botnick': irc.nick,
|
||||
'network': irc.network,
|
||||
})
|
||||
|
||||
if msg:
|
||||
|
@ -219,6 +219,8 @@ class FunctionsTestCase(SupyTestCase):
|
||||
msg = ircmsgs.IrcMsg(':%s PRIVMSG #channel :stuff' % self.hostmask)
|
||||
class Irc(object):
|
||||
nick = 'bob'
|
||||
network = 'testnet'
|
||||
|
||||
irc = Irc()
|
||||
|
||||
f = ircutils.standardSubstitute
|
||||
|
@ -41,6 +41,7 @@ class FunctionsTestCase(SupyTestCase):
|
||||
class state:
|
||||
channels = {'#foo': holder()}
|
||||
nick = 'foobar'
|
||||
network = 'testnet'
|
||||
|
||||
@retry()
|
||||
def testStandardSubstitute(self):
|
||||
@ -82,6 +83,9 @@ class FunctionsTestCase(SupyTestCase):
|
||||
c = f(self.irc, msg, '$channel')
|
||||
self.assertEqual(c, msg.args[0])
|
||||
|
||||
net = f(self.irc, msg, '$network')
|
||||
self.assertEqual(net, self.irc.network)
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user