From 3697ecbebfd99cbfbb776b8ec70c8c4cb7ee6383 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Thu, 13 Jun 2019 02:04:01 -0400 Subject: [PATCH] wip --- .../server_tests/test_labeled_responses.py | 48 +++++++++---------- irctest/server_tests/test_resume.py | 16 +++---- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/irctest/server_tests/test_labeled_responses.py b/irctest/server_tests/test_labeled_responses.py index 766b755..1ea9576 100644 --- a/irctest/server_tests/test_labeled_responses.py +++ b/irctest/server_tests/test_labeled_responses.py @@ -9,13 +9,13 @@ from irctest import cases class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper): @cases.SpecificationSelector.requiredBySpecification('IRCv3.2') def testLabeledPrivmsgResponsesToMultipleClients(self): - self.connectClient('foo', capabilities=['batch', 'echo-message', 'draft/labeled-response'], skip_if_cap_nak=True) + self.connectClient('foo', capabilities=['batch', 'echo-message', 'draft/labeled-response-0.2'], skip_if_cap_nak=True) self.getMessages(1) - self.connectClient('bar', capabilities=['batch', 'echo-message', 'draft/labeled-response'], skip_if_cap_nak=True) + self.connectClient('bar', capabilities=['batch', 'echo-message', 'draft/labeled-response-0.2'], skip_if_cap_nak=True) self.getMessages(2) - self.connectClient('carl', capabilities=['batch', 'echo-message', 'draft/labeled-response'], skip_if_cap_nak=True) + self.connectClient('carl', capabilities=['batch', 'echo-message', 'draft/labeled-response-0.2'], skip_if_cap_nak=True) self.getMessages(3) - self.connectClient('alice', capabilities=['batch', 'echo-message', 'draft/labeled-response'], skip_if_cap_nak=True) + self.connectClient('alice', capabilities=['batch', 'echo-message', 'draft/labeled-response-0.2'], skip_if_cap_nak=True) self.getMessages(4) self.sendLine(1, '@draft/label=12345 PRIVMSG bar,carl,alice :hi') @@ -36,9 +36,9 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper @cases.SpecificationSelector.requiredBySpecification('IRCv3.2') def testLabeledPrivmsgResponsesToClient(self): - self.connectClient('foo', capabilities=['batch', 'echo-message', 'draft/labeled-response'], skip_if_cap_nak=True) + self.connectClient('foo', capabilities=['batch', 'echo-message', 'draft/labeled-response-0.2'], skip_if_cap_nak=True) self.getMessages(1) - self.connectClient('bar', capabilities=['batch', 'echo-message', 'draft/labeled-response'], skip_if_cap_nak=True) + self.connectClient('bar', capabilities=['batch', 'echo-message', 'draft/labeled-response-0.2'], skip_if_cap_nak=True) self.getMessages(2) self.sendLine(1, '@draft/label=12345 PRIVMSG bar :hi') @@ -55,9 +55,9 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper @cases.SpecificationSelector.requiredBySpecification('IRCv3.2') def testLabeledPrivmsgResponsesToChannel(self): - self.connectClient('foo', capabilities=['batch', 'echo-message', 'draft/labeled-response'], skip_if_cap_nak=True) + self.connectClient('foo', capabilities=['batch', 'echo-message', 'draft/labeled-response-0.2'], skip_if_cap_nak=True) self.getMessages(1) - self.connectClient('bar', capabilities=['batch', 'echo-message', 'draft/labeled-response'], skip_if_cap_nak=True) + self.connectClient('bar', capabilities=['batch', 'echo-message', 'draft/labeled-response-0.2'], skip_if_cap_nak=True) self.getMessages(2) # join channels @@ -82,7 +82,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper @cases.SpecificationSelector.requiredBySpecification('IRCv3.2') def testLabeledPrivmsgResponsesToSelf(self): - self.connectClient('foo', capabilities=['batch', 'echo-message', 'draft/labeled-response'], skip_if_cap_nak=True) + self.connectClient('foo', capabilities=['batch', 'echo-message', 'draft/labeled-response-0.2'], skip_if_cap_nak=True) self.getMessages(1) self.sendLine(1, '@draft/label=12345 PRIVMSG foo :hi') @@ -100,9 +100,9 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper @cases.SpecificationSelector.requiredBySpecification('IRCv3.2') def testLabeledNoticeResponsesToClient(self): - self.connectClient('foo', capabilities=['batch', 'echo-message', 'draft/labeled-response'], skip_if_cap_nak=True) + self.connectClient('foo', capabilities=['batch', 'echo-message', 'draft/labeled-response-0.2'], skip_if_cap_nak=True) self.getMessages(1) - self.connectClient('bar', capabilities=['batch', 'echo-message', 'draft/labeled-response'], skip_if_cap_nak=True) + self.connectClient('bar', capabilities=['batch', 'echo-message', 'draft/labeled-response-0.2'], skip_if_cap_nak=True) self.getMessages(2) self.sendLine(1, '@draft/label=12345 NOTICE bar :hi') @@ -119,9 +119,9 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper @cases.SpecificationSelector.requiredBySpecification('IRCv3.2') def testLabeledNoticeResponsesToChannel(self): - self.connectClient('foo', capabilities=['batch', 'echo-message', 'draft/labeled-response'], skip_if_cap_nak=True) + self.connectClient('foo', capabilities=['batch', 'echo-message', 'draft/labeled-response-0.2'], skip_if_cap_nak=True) self.getMessages(1) - self.connectClient('bar', capabilities=['batch', 'echo-message', 'draft/labeled-response'], skip_if_cap_nak=True) + self.connectClient('bar', capabilities=['batch', 'echo-message', 'draft/labeled-response-0.2'], skip_if_cap_nak=True) self.getMessages(2) # join channels @@ -146,7 +146,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper @cases.SpecificationSelector.requiredBySpecification('IRCv3.2') def testLabeledNoticeResponsesToSelf(self): - self.connectClient('foo', capabilities=['batch', 'echo-message', 'draft/labeled-response'], skip_if_cap_nak=True) + self.connectClient('foo', capabilities=['batch', 'echo-message', 'draft/labeled-response-0.2'], skip_if_cap_nak=True) self.getMessages(1) self.sendLine(1, '@draft/label=12345 NOTICE foo :hi') @@ -164,9 +164,9 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper @cases.SpecificationSelector.requiredBySpecification('IRCv3.2') def testLabeledTagMsgResponsesToClient(self): - self.connectClient('foo', capabilities=['batch', 'echo-message', 'draft/labeled-response', 'message-tags'], skip_if_cap_nak=True) + self.connectClient('foo', capabilities=['batch', 'echo-message', 'draft/labeled-response-0.2', 'message-tags'], skip_if_cap_nak=True) self.getMessages(1) - self.connectClient('bar', capabilities=['batch', 'echo-message', 'draft/labeled-response', 'message-tags'], skip_if_cap_nak=True) + self.connectClient('bar', capabilities=['batch', 'echo-message', 'draft/labeled-response-0.2', 'message-tags'], skip_if_cap_nak=True) self.getMessages(2) self.sendLine(1, '@draft/label=12345;+draft/reply=123;+draft/react=l😃l TAGMSG bar') @@ -191,9 +191,9 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper @cases.SpecificationSelector.requiredBySpecification('IRCv3.2') def testLabeledTagMsgResponsesToChannel(self): - self.connectClient('foo', capabilities=['batch', 'echo-message', 'draft/labeled-response', 'message-tags'], skip_if_cap_nak=True) + self.connectClient('foo', capabilities=['batch', 'echo-message', 'draft/labeled-response-0.2', 'message-tags'], skip_if_cap_nak=True) self.getMessages(1) - self.connectClient('bar', capabilities=['batch', 'echo-message', 'draft/labeled-response', 'message-tags'], skip_if_cap_nak=True) + self.connectClient('bar', capabilities=['batch', 'echo-message', 'draft/labeled-response-0.2', 'message-tags'], skip_if_cap_nak=True) self.getMessages(2) # join channels @@ -218,7 +218,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper @cases.SpecificationSelector.requiredBySpecification('IRCv3.2') def testLabeledTagMsgResponsesToSelf(self): - self.connectClient('foo', capabilities=['batch', 'echo-message', 'draft/labeled-response', 'message-tags'], skip_if_cap_nak=True) + self.connectClient('foo', capabilities=['batch', 'echo-message', 'draft/labeled-response-0.2', 'message-tags'], skip_if_cap_nak=True) self.getMessages(1) self.sendLine(1, '@draft/label=12345;+draft/reply=123;+draft/react=l😃l TAGMSG foo') @@ -236,7 +236,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper @cases.SpecificationSelector.requiredBySpecification('IRCv3.2') def testBatchedJoinMessages(self): - self.connectClient('bar', capabilities=['batch', 'draft/labeled-response', 'message-tags', 'server-time'], skip_if_cap_nak=True) + self.connectClient('bar', capabilities=['batch', 'draft/labeled-response-0.2', 'message-tags', 'server-time'], skip_if_cap_nak=True) self.getMessages(1) self.sendLine(1, '@draft/label=12345 JOIN #xyz') @@ -253,7 +253,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper batch_id = batch_start.params[0][1:] # batch id MUST be alphanumerics and hyphens self.assertTrue(re.match(r'^[A-Za-z0-9\-]+$', batch_id) is not None, 'batch id must be alphanumerics and hyphens, got %r' % (batch_id,)) - self.assertEqual(batch_start.params[1], 'draft/labeled-response') + self.assertEqual(batch_start.params[1], 'draft/labeled-response-0.2') self.assertEqual(batch_start.tags.get('draft/label'), '12345') # valid BATCH end line @@ -266,7 +266,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper @cases.SpecificationSelector.requiredBySpecification('Oragono') def testNoBatchForSingleMessage(self): - self.connectClient('bar', capabilities=['batch', 'draft/labeled-response', 'message-tags', 'server-time']) + self.connectClient('bar', capabilities=['batch', 'draft/labeled-response-0.2', 'message-tags', 'server-time']) self.getMessages(1) self.sendLine(1, '@draft/label=98765 PING adhoctestline') @@ -280,14 +280,14 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper @cases.SpecificationSelector.requiredBySpecification('Oragono') def testEmptyBatchForNoResponse(self): - self.connectClient('bar', capabilities=['batch', 'draft/labeled-response', 'message-tags', 'server-time']) + self.connectClient('bar', capabilities=['batch', 'draft/labeled-response-0.2', 'message-tags', 'server-time']) self.getMessages(1) # PONG never receives a response self.sendLine(1, '@draft/label=98765 PONG adhoctestline') # "If no response is required, an empty batch MUST be sent." - # https://ircv3.net/specs/extensions/labeled-response.html + # https://ircv3.net/specs/extensions/labeled-response-0.2.html ms = self.getMessages(1) self.assertEqual(len(ms), 2) batch_start, batch_end = ms diff --git a/irctest/server_tests/test_resume.py b/irctest/server_tests/test_resume.py index a4c582e..9b9e077 100644 --- a/irctest/server_tests/test_resume.py +++ b/irctest/server_tests/test_resume.py @@ -12,17 +12,17 @@ class ResumeTestCase(cases.BaseServerTestCase): @cases.SpecificationSelector.requiredBySpecification('Oragono') def testNoResumeByDefault(self): - self.connectClient('bar', capabilities=['batch', 'echo-message', 'draft/labeled-response']) + self.connectClient('bar', capabilities=['batch', 'echo-message', 'draft/labeled-response-0.2']) ms = self.getMessages(1) resume_messages = [m for m in ms if m.command == 'RESUME'] self.assertEqual(resume_messages, [], 'should not see RESUME messages unless explicitly negotiated') @cases.SpecificationSelector.requiredBySpecification('Oragono') def testResume(self): - self.connectClient('bar', capabilities=['batch', 'draft/labeled-response', 'server-time']) + self.connectClient('bar', capabilities=['batch', 'draft/labeled-response-0.2', 'server-time']) ms = self.getMessages(1) - welcome = self.connectClient('baz', capabilities=['batch', 'draft/labeled-response', 'server-time', 'draft/resume-0.5']) + welcome = self.connectClient('baz', capabilities=['batch', 'draft/labeled-response-0.2', 'server-time', 'draft/resume-0.5']) resume_messages = [m for m in welcome if m.command == 'RESUME'] self.assertEqual(len(resume_messages), 1) self.assertEqual(resume_messages[0].params[0], 'TOKEN') @@ -46,7 +46,7 @@ class ResumeTestCase(cases.BaseServerTestCase): bad_token = 'a' * len(token) self.addClient() self.sendLine(3, 'CAP LS') - self.sendLine(3, 'CAP REQ :batch draft/labeled-response server-time draft/resume-0.5') + self.sendLine(3, 'CAP REQ :batch draft/labeled-response-0.2 server-time draft/resume-0.5') self.sendLine(3, 'NICK tempnick') self.sendLine(3, 'USER tempuser 0 * tempuser') self.sendLine(3, ' '.join(('RESUME', bad_token, ANCIENT_TIMESTAMP))) @@ -62,7 +62,7 @@ class ResumeTestCase(cases.BaseServerTestCase): self.addClient() self.sendLine(4, 'CAP LS') - self.sendLine(4, 'CAP REQ :batch draft/labeled-response server-time draft/resume-0.5') + self.sendLine(4, 'CAP REQ :batch draft/labeled-response-0.2 server-time draft/resume-0.5') self.sendLine(4, 'NICK tempnick_') self.sendLine(4, 'USER tempuser 0 * tempuser') # resume with a timestamp in the distant past @@ -108,7 +108,7 @@ class ResumeTestCase(cases.BaseServerTestCase): # test chain-resuming (resuming the resumed connection, using the new token) self.addClient() self.sendLine(5, 'CAP LS') - self.sendLine(5, 'CAP REQ :batch draft/labeled-response server-time draft/resume-0.5') + self.sendLine(5, 'CAP REQ :batch draft/labeled-response-0.2 server-time draft/resume-0.5') self.sendLine(5, 'NICK tempnick_') self.sendLine(5, 'USER tempuser 0 * tempuser') self.sendLine(5, 'RESUME ' + new_token) @@ -126,11 +126,11 @@ class ResumeTestCase(cases.BaseServerTestCase): @cases.SpecificationSelector.requiredBySpecification('Oragono') def testBRB(self): - self.connectClient('bar', capabilities=['batch', 'draft/labeled-response', 'message-tags', 'server-time', 'draft/resume-0.5']) + self.connectClient('bar', capabilities=['batch', 'draft/labeled-response-0.2', 'message-tags', 'server-time', 'draft/resume-0.5']) ms = self.getMessages(1) self.joinChannel(1, '#xyz') - welcome = self.connectClient('baz', capabilities=['batch', 'draft/labeled-response', 'server-time', 'draft/resume-0.5']) + welcome = self.connectClient('baz', capabilities=['batch', 'draft/labeled-response-0.2', 'server-time', 'draft/resume-0.5']) resume_messages = [m for m in welcome if m.command == 'RESUME'] self.assertEqual(len(resume_messages), 1) self.assertEqual(resume_messages[0].params[0], 'TOKEN')