Merge pull request #682 from monodemono/testing

Removed extra spaces & pipe from default separator
This commit is contained in:
Valentin Lorentz 2014-05-26 22:02:41 +02:00
commit 977eb319f6
2 changed files with 27 additions and 26 deletions

View File

@ -47,7 +47,7 @@ class TopicFormat(registry.TemplatedString):
Topic = conf.registerPlugin('Topic')
conf.registerChannelValue(Topic, 'separator',
registry.StringSurroundedBySpaces(' || ', _("""Determines what separator is
registry.StringSurroundedBySpaces('|', _("""Determines what separator is
used between individually added topics in the channel topic.""")))
conf.registerChannelValue(Topic, 'format',
TopicFormat('$topic', _("""Determines what format is used to add

View File

@ -69,7 +69,7 @@ class TopicTestCase(ChannelPluginTestCase):
m = self.getMsg('topic add bar')
self.assertEqual(m.command, 'TOPIC')
self.assertEqual(m.args[0], self.channel)
self.assertEqual(m.args[1], 'foo || bar')
self.assertEqual(m.args[1], 'foo | bar')
def testManageCapabilities(self):
try:
@ -95,7 +95,7 @@ class TopicTestCase(ChannelPluginTestCase):
m = self.getMsg('topic add foo')
self.assertEqual(m.args[1], 'foo')
m = self.getMsg('topic insert bar')
self.assertEqual(m.args[1], 'bar || foo')
self.assertEqual(m.args[1], 'bar | foo')
def testChange(self):
_ = self.getMsg('topic add foo')
@ -168,9 +168,9 @@ class TopicTestCase(ChannelPluginTestCase):
conf.supybot.plugins.Topic.format.setValue('$topic')
self.assertResponse('topic set ""', '')
self.assertResponse('topic add foo', 'foo')
self.assertResponse('topic add bar', 'foo || bar')
self.assertResponse('topic add baz', 'foo || bar || baz')
self.assertResponse('topic undo', 'foo || bar')
self.assertResponse('topic add bar', 'foo | bar')
self.assertResponse('topic add baz', 'foo | bar | baz')
self.assertResponse('topic undo', 'foo | bar')
self.assertResponse('topic undo', 'foo')
self.assertResponse('topic undo', '')
finally:
@ -182,19 +182,19 @@ class TopicTestCase(ChannelPluginTestCase):
conf.supybot.plugins.Topic.format.setValue('$topic')
self.assertResponse('topic set ""', '')
self.assertResponse('topic add foo', 'foo')
self.assertResponse('topic add bar', 'foo || bar')
self.assertResponse('topic add baz', 'foo || bar || baz')
self.assertResponse('topic undo', 'foo || bar')
self.assertResponse('topic add bar', 'foo | bar')
self.assertResponse('topic add baz', 'foo | bar | baz')
self.assertResponse('topic undo', 'foo | bar')
self.assertResponse('topic undo', 'foo')
self.assertResponse('topic undo', '')
self.assertResponse('topic redo', 'foo')
self.assertResponse('topic redo', 'foo || bar')
self.assertResponse('topic redo', 'foo || bar || baz')
self.assertResponse('topic undo', 'foo || bar')
self.assertResponse('topic redo', 'foo | bar')
self.assertResponse('topic redo', 'foo | bar | baz')
self.assertResponse('topic undo', 'foo | bar')
self.assertResponse('topic undo', 'foo')
self.assertResponse('topic redo', 'foo || bar')
self.assertResponse('topic redo', 'foo | bar')
self.assertResponse('topic undo', 'foo')
self.assertResponse('topic redo', 'foo || bar')
self.assertResponse('topic redo', 'foo | bar')
finally:
conf.supybot.plugins.Topic.format.setValue(original)
@ -204,10 +204,10 @@ class TopicTestCase(ChannelPluginTestCase):
conf.supybot.plugins.Topic.format.setValue('$topic')
self.assertResponse('topic set ""', '')
self.assertResponse('topic add foo', 'foo')
self.assertResponse('topic add bar', 'foo || bar')
self.assertResponse('topic add baz', 'foo || bar || baz')
self.assertResponse('topic swap 1 2', 'bar || foo || baz')
self.assertResponse('topic swap 1 -1', 'baz || foo || bar')
self.assertResponse('topic add bar', 'foo | bar')
self.assertResponse('topic add baz', 'foo | bar | baz')
self.assertResponse('topic swap 1 2', 'bar | foo | baz')
self.assertResponse('topic swap 1 -1', 'baz | foo | bar')
self.assertError('topic swap -1 -1')
self.assertError('topic swap 2 -2')
self.assertError('topic swap 1 -3')
@ -232,8 +232,8 @@ class TopicTestCase(ChannelPluginTestCase):
conf.supybot.plugins.Topic.format.setValue('$topic')
self.assertError('topic addd') # Error to send too many args.
self.assertResponse('topic add foo', 'foo')
self.assertResponse('topic add bar', 'foo || bar')
self.assertResponse('topic', 'foo || bar')
self.assertResponse('topic add bar', 'foo | bar')
self.assertResponse('topic', 'foo | bar')
finally:
conf.supybot.plugins.Topic.format.setValue(original)
@ -242,11 +242,12 @@ class TopicTestCase(ChannelPluginTestCase):
try:
conf.supybot.plugins.Topic.format.setValue('$topic')
self.assertResponse('topic add foo', 'foo')
self.assertResponse('topic add bar', 'foo || bar')
self.assertResponse('topic add baz', 'foo || bar || baz')
self.assertResponse('topic separator |', 'foo | bar | baz')
self.assertResponse('topic add bar', 'foo | bar')
self.assertResponse('topic add baz', 'foo | bar | baz')
self.assertResponse('topic separator ::', 'foo :: bar :: baz')
self.assertResponse('topic separator ||', 'foo || bar || baz')
self.assertResponse('topic separator |', 'foo | bar | baz')
finally:
conf.supybot.plugins.Topic.format.setValue(original)
@ -256,9 +257,9 @@ class TopicTestCase(ChannelPluginTestCase):
conf.supybot.plugins.Topic.format.setValue('$topic')
self.irc.state.supported['TOPICLEN'] = 20
self.assertResponse('topic fit foo', 'foo')
self.assertResponse('topic fit bar', 'foo || bar')
self.assertResponse('topic fit baz', 'foo || bar || baz')
self.assertResponse('topic fit qux', 'bar || baz || qux')
self.assertResponse('topic fit bar', 'foo | bar')
self.assertResponse('topic fit baz', 'foo | bar | baz')
self.assertResponse('topic fit qux', 'bar | baz | qux')
finally:
conf.supybot.plugins.Topic.format.setValue(original)
self.irc.state.supported.pop('TOPICLEN', None)