Remove getIsupport(), it's redundant with server_support

This commit is contained in:
Valentin Lorentz 2021-02-27 15:57:02 +01:00
parent 22eb8d4369
commit 51d0ce4483
3 changed files with 7 additions and 24 deletions

View File

@ -10,7 +10,7 @@ import pytest
from . import client_mock, runner from . import client_mock, runner
from .exceptions import ConnectionClosed from .exceptions import ConnectionClosed
from .irc_utils import capabilities, message_parser from .irc_utils import capabilities, message_parser
from .irc_utils.junkdrawer import normalizeWhitespace, random_name from .irc_utils.junkdrawer import normalizeWhitespace
from .irc_utils.sasl import sasl_plain_blob from .irc_utils.sasl import sasl_plain_blob
from .numerics import ( from .numerics import (
ERR_BADCHANNELKEY, ERR_BADCHANNELKEY,
@ -371,7 +371,7 @@ class BaseServerTestCase(_IrcTestCase):
def setUp(self): def setUp(self):
super().setUp() super().setUp()
self.server_support = {} self.server_support = None
self.find_hostname_and_port() self.find_hostname_and_port()
self.controller.run( self.controller.run(
self.hostname, self.hostname,
@ -503,6 +503,7 @@ class BaseServerTestCase(_IrcTestCase):
self.sendLine(client, "PING foo") self.sendLine(client, "PING foo")
# Skip all that happy welcoming stuff # Skip all that happy welcoming stuff
self.server_support = {}
while True: while True:
m = self.getMessage(client) m = self.getMessage(client)
if m.command == "PONG": if m.command == "PONG":
@ -545,25 +546,6 @@ class BaseServerTestCase(_IrcTestCase):
elif msg.command in CHANNEL_JOIN_FAIL_NUMERICS: elif msg.command in CHANNEL_JOIN_FAIL_NUMERICS:
raise ChannelJoinException(msg.command, msg.params) raise ChannelJoinException(msg.command, msg.params)
def getISupport(self):
cn = random_name("bar")
self.addClient(name=cn)
self.sendLine(cn, "NICK %s" % (cn,))
self.sendLine(cn, "USER u s e r")
messages = self.getMessages(cn)
isupport = {}
for message in messages:
if message.command != "005":
continue
# 005 nick <tokens...> :are supported by this server
tokens = message.params[1:-1]
for token in tokens:
name, _, value = token.partition("=")
isupport[name] = value
self.sendLine(cn, "QUIT")
self.assertDisconnected(cn)
return isupport
class OptionalityHelper: class OptionalityHelper:
def checkSaslSupport(self): def checkSaslSupport(self):

View File

@ -1132,7 +1132,8 @@ class OpModerated(cases.BaseServerTestCase):
class MuteExtban(cases.BaseServerTestCase): class MuteExtban(cases.BaseServerTestCase):
@cases.mark_specifications("Oragono") @cases.mark_specifications("Oragono")
def testISupport(self): def testISupport(self):
isupport = self.getISupport() self.connectClient(1) # Fetches ISUPPORT
isupport = self.server_support
token = isupport["EXTBAN"] token = isupport["EXTBAN"]
prefix, comma, types = token.partition(",") prefix, comma, types = token.partition(",")
self.assertEqual(prefix, "") self.assertEqual(prefix, "")

View File

@ -6,8 +6,8 @@ class StatusmsgTestCase(cases.BaseServerTestCase):
@cases.mark_specifications("Oragono") @cases.mark_specifications("Oragono")
def testInIsupport(self): def testInIsupport(self):
"""Check that the expected STATUSMSG parameter appears in our isupport list.""" """Check that the expected STATUSMSG parameter appears in our isupport list."""
isupport = self.getISupport() self.connectClient("foo") # detects ISUPPORT
self.assertEqual(isupport["STATUSMSG"], "~&@%+") self.assertEqual(self.server_support["STATUSMSG"], "~&@%+")
@cases.mark_specifications("Oragono") @cases.mark_specifications("Oragono")
def testStatusmsg(self): def testStatusmsg(self):