From ca8b3cf62599c021bb0aaa9e710f1a597174171d Mon Sep 17 00:00:00 2001 From: Daniel Oaks Date: Wed, 30 Nov 2016 01:19:19 +1000 Subject: [PATCH] Add Deprecated test classes, for ones that shouldn't be run by default these days --- irctest/__main__.py | 8 ++++++-- .../server_tests/test_channel_operations.py | 9 +++++---- irctest/server_tests/test_metadata.py | 18 +++++++++--------- irctest/specifications.py | 2 ++ 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/irctest/__main__.py b/irctest/__main__.py index 67f64d9..3bba305 100644 --- a/irctest/__main__.py +++ b/irctest/__main__.py @@ -40,8 +40,12 @@ def main(args): .format(', '.join(args.specification))) exit(1) else: - _IrcTestCase.testedSpecifications = frozenset( - Specifications) + specs = list(Specifications) + # remove deprecated specs + specs.remove(Specifications.RFCDeprecated) + specs.remove(Specifications.IRC302Deprecated) + + _IrcTestCase.testedSpecifications = frozenset(specs) print('Testing {} on specification(s): {}'.format( controller_class.software_name, ', '.join(sorted(map(lambda x:x.value, diff --git a/irctest/server_tests/test_channel_operations.py b/irctest/server_tests/test_channel_operations.py index 0adc71b..e947a41 100644 --- a/irctest/server_tests/test_channel_operations.py +++ b/irctest/server_tests/test_channel_operations.py @@ -150,11 +150,12 @@ class JoinTestCase(cases.BaseServerTestCase): self.connectClient('foo') self.connectClient('bar') self.sendLine(1, 'JOIN #chan') + self.getMessages(1) self.sendLine(2, 'JOIN #chan') + self.getMessages(2) # TODO: check foo is opped OR +t is unset - self.getMessages(1) - self.getMessages(2) + # clear waiting msgs about cli 2 joining the channel self.getMessages(1) self.sendLine(1, 'TOPIC #chan :T0P1C') @@ -359,7 +360,7 @@ class JoinTestCase(cases.BaseServerTestCase): self.assertMessageEqual(m, command='KICK', params=['#chan', 'baz', 'bye']) - @cases.SpecificationSelector.requiredBySpecification('RFC1459', 'RFC2812') + @cases.SpecificationSelector.requiredBySpecification('RFC-deprecated') def testInviteNonExistingChannelTransmitted(self): """“There is no requirement that the channel the target user is being invited to must exist or be a valid channel.” @@ -386,7 +387,7 @@ class JoinTestCase(cases.BaseServerTestCase): '#chan, “bar” should have received “INVITE #chan bar” but ' 'got this instead: {msg}') - @cases.SpecificationSelector.requiredBySpecification('RFC1459', 'RFC2812') + @cases.SpecificationSelector.requiredBySpecification('RFC-deprecated') def testInviteNonExistingChannelEchoed(self): """“There is no requirement that the channel the target user is being invited to must exist or be a valid channel.” diff --git a/irctest/server_tests/test_metadata.py b/irctest/server_tests/test_metadata.py index 5c43691..76a3026 100644 --- a/irctest/server_tests/test_metadata.py +++ b/irctest/server_tests/test_metadata.py @@ -9,7 +9,7 @@ from irctest.irc_utils.message_parser import Message class MetadataTestCase(cases.BaseServerTestCase): valid_metadata_keys = {'valid_key1', 'valid_key2'} invalid_metadata_keys = {'invalid_key1', 'invalid_key2'} - @cases.SpecificationSelector.requiredBySpecification('IRCv3.2') + @cases.SpecificationSelector.requiredBySpecification('IRCv3.2-deprecated') def testInIsupport(self): """“If METADATA is supported, it MUST be specified in RPL_ISUPPORT using the METADATA key.” @@ -29,7 +29,7 @@ class MetadataTestCase(cases.BaseServerTestCase): fail_msg='{item} missing from RPL_ISUPPORT') self.getMessages(1) - @cases.SpecificationSelector.requiredBySpecification('IRCv3.2') + @cases.SpecificationSelector.requiredBySpecification('IRCv3.2-deprecated') def testGetOneUnsetValid(self): """ """ @@ -40,7 +40,7 @@ class MetadataTestCase(cases.BaseServerTestCase): fail_msg='Did not reply with 766 (ERR_NOMATCHINGKEY) to a ' 'request to an unset valid METADATA key.') - @cases.SpecificationSelector.requiredBySpecification('IRCv3.2') + @cases.SpecificationSelector.requiredBySpecification('IRCv3.2-deprecated') def testGetTwoUnsetValid(self): """“Multiple keys may be given. The response will be either RPL_KEYVALUE, ERR_KEYINVALID or ERR_NOMATCHINGKEY for every key in order.” @@ -63,7 +63,7 @@ class MetadataTestCase(cases.BaseServerTestCase): fail_msg='Response to “METADATA * GET valid_key1 valid_key2” ' 'did not respond to valid_key2 as second response: {msg}') - @cases.SpecificationSelector.requiredBySpecification('IRCv3.2') + @cases.SpecificationSelector.requiredBySpecification('IRCv3.2-deprecated') def testListNoSet(self): """“This subcommand MUST list all currently-set metadata keys along with their values. The response will be zero or more RPL_KEYVALUE @@ -77,7 +77,7 @@ class MetadataTestCase(cases.BaseServerTestCase): fail_msg='Response to “METADATA * LIST” was not ' '762 (RPL_METADATAEND) but: {msg}') - @cases.SpecificationSelector.requiredBySpecification('IRCv3.2') + @cases.SpecificationSelector.requiredBySpecification('IRCv3.2-deprecated') def testListInvalidTarget(self): """“In case of invalid target RPL_METADATAEND MUST NOT be sent.” -- @@ -131,14 +131,14 @@ class MetadataTestCase(cases.BaseServerTestCase): self.assertSetValue(target, key, value, displayable_value) self.assertGetValue(target, key, value, displayable_value) - @cases.SpecificationSelector.requiredBySpecification('IRCv3.2') + @cases.SpecificationSelector.requiredBySpecification('IRCv3.2-deprecated') def testSetGetValid(self): """ """ self.connectClient('foo') self.assertSetGetValue('*', 'valid_key1', 'myvalue') - @cases.SpecificationSelector.requiredBySpecification('IRCv3.2') + @cases.SpecificationSelector.requiredBySpecification('IRCv3.2-deprecated') def testSetGetZeroCharInValue(self): """“Values are unrestricted, except that they MUST be UTF-8.” -- @@ -147,7 +147,7 @@ class MetadataTestCase(cases.BaseServerTestCase): self.assertSetGetValue('*', 'valid_key1', 'zero->\0<-zero', 'zero->\\0<-zero') - @cases.SpecificationSelector.requiredBySpecification('IRCv3.2') + @cases.SpecificationSelector.requiredBySpecification('IRCv3.2-deprecated') def testSetGetHeartInValue(self): """“Values are unrestricted, except that they MUST be UTF-8.” -- @@ -157,7 +157,7 @@ class MetadataTestCase(cases.BaseServerTestCase): self.assertSetGetValue('*', 'valid_key1', '->{}<-'.format(heart), 'zero->{}<-zero'.format(heart.encode())) - @cases.SpecificationSelector.requiredBySpecification('IRCv3.2') + @cases.SpecificationSelector.requiredBySpecification('IRCv3.2-deprecated') def testSetInvalidUtf8(self): """“Values are unrestricted, except that they MUST be UTF-8.” -- diff --git a/irctest/specifications.py b/irctest/specifications.py index 01c9f39..939ee8a 100644 --- a/irctest/specifications.py +++ b/irctest/specifications.py @@ -4,8 +4,10 @@ import enum class Specifications(enum.Enum): RFC1459 = 'RFC1459' RFC2812 = 'RFC2812' + RFCDeprecated = 'RFC-deprecated' IRC301 = 'IRCv3.1' IRC302 = 'IRCv3.2' + IRC302Deprecated = 'IRCv3.2-deprecated' @classmethod def of_name(cls, name):