From 463733c772b5b0c802cc33a02cc989c1ec79c0ef Mon Sep 17 00:00:00 2001 From: Daniel Oaks Date: Wed, 4 Oct 2017 18:44:43 +1000 Subject: [PATCH] channels: Check server casemapping before doing mapping checks --- .../server_tests/test_channel_operations.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/irctest/server_tests/test_channel_operations.py b/irctest/server_tests/test_channel_operations.py index 2280dca..727902d 100644 --- a/irctest/server_tests/test_channel_operations.py +++ b/irctest/server_tests/test_channel_operations.py @@ -414,12 +414,14 @@ class JoinTestCase(cases.BaseServerTestCase): 'got this instead: {msg}') class testChannelCaseSensitivity(cases.BaseServerTestCase): - def _testChannelsEquivalent(name1, name2): + def _testChannelsEquivalent(casemapping, name1, name2): @cases.SpecificationSelector.requiredBySpecification('RFC1459', 'RFC2812', strict=True) def f(self): self.connectClient('foo') self.connectClient('bar') + if self.server_support['CASEMAPPING'] != casemapping: + raise runner.NotImplementedByController('Casemapping {} not implemented'.format(casemapping)) self.joinClient(1, name1) self.joinClient(2, name2) try: @@ -432,12 +434,14 @@ class testChannelCaseSensitivity(cases.BaseServerTestCase): .format(name1, name2)) f.__name__ = 'testEquivalence__{}__{}'.format(name1, name2) return f - def _testChannelsNotEquivalent(name1, name2): + def _testChannelsNotEquivalent(casemapping, name1, name2): @cases.SpecificationSelector.requiredBySpecification('RFC1459', 'RFC2812', strict=True) def f(self): self.connectClient('foo') self.connectClient('bar') + if self.server_support['CASEMAPPING'] != casemapping: + raise runner.NotImplementedByController('Casemapping {} not implemented'.format(casemapping)) self.joinClient(1, name1) self.joinClient(2, name2) try: @@ -453,7 +457,10 @@ class testChannelCaseSensitivity(cases.BaseServerTestCase): f.__name__ = 'testEquivalence__{}__{}'.format(name1, name2) return f - testSimpleEquivalent = _testChannelsEquivalent('#Foo', '#foo') - testSimpleNotEquivalent = _testChannelsNotEquivalent('#Foo', '#fooa') - testFancyEquivalent = _testChannelsEquivalent('#F]|oo{', '#f}\\oo[') - testFancyNotEquivalent = _testChannelsEquivalent('#F}o\\o[', '#f]o|o{') + testAsciiSimpleEquivalent = _testChannelsEquivalent('ascii', '#Foo', '#foo') + testAsciiSimpleNotEquivalent = _testChannelsNotEquivalent('ascii', '#Foo', '#fooa') + + testRfcSimpleEquivalent = _testChannelsEquivalent('rfc1459', '#Foo', '#foo') + testRfcSimpleNotEquivalent = _testChannelsNotEquivalent('rfc1459', '#Foo', '#fooa') + testRfcFancyEquivalent = _testChannelsEquivalent('rfc1459', '#F]|oo{', '#f}\\oo[') + testRfcFancyNotEquivalent = _testChannelsEquivalent('rfc1459', '#F}o\\o[', '#f]o|o{')