Improve error messages.

This commit is contained in:
Valentin Lorentz 2015-12-23 19:05:21 +01:00
parent d3617b7012
commit 4ef79cbe45
2 changed files with 11 additions and 8 deletions

View File

@ -259,15 +259,15 @@ class JoinTestCase(cases.BaseServerTestCase):
'but: {msg}')
m = self.getMessage(2)
self.assertNotEqual(m.command, '323', # RPL_LISTEND
'LIST response ended (ie. 323, aka RPL_LISTEND) without '
'listing any channel, whereas there is one.')
fail_msg='LIST response ended (ie. 323, aka RPL_LISTEND) '
'without listing any channel, whereas there is one.')
self.assertMessageEqual(m, command='322', # RPL_LIST
fail_msg='Second reply to LIST is not 322 (RPL_LIST), '
'nor 323 (RPL_LISTEND) but: {msg}')
m = self.getMessage(2)
self.assertNotEqual(m.command, '322', # RPL_LIST
'LIST response gives (at least) two channels, whereas there '
'is only one.')
fail_msg='LIST response gives (at least) two channels, '
'whereas there is only one.')
self.assertMessageEqual(m, command='323', # RPL_LISTEND
fail_msg='Third reply to LIST is not 322 (RPL_LIST) '
'or 323 (RPL_LISTEND), or but: {msg}')

View File

@ -65,14 +65,17 @@ class ConnectionRegistrationTestCase(cases.BaseServerTestCase):
@cases.SpecificationSelector.requiredBySpecification('RFC2812')
def testQuitErrors(self):
"""The server must close the connection to a client which sends a
QUIT message.
-- <https://tools.ietf.org/html/rfc1459#section-4.1.3>
"""A client session is terminated with a quit message. The server
acknowledges this by sending an ERROR message to the client.
-- <https://tools.ietf.org/html/rfc2812#section-3.1.7>
"""
self.connectClient('foo')
self.getMessages(1)
self.sendLine(1, 'QUIT')
commands = {m.command for me in self.getMessages(1)}
try:
commands = {m.command for me in self.getMessages(1)}
except ConnectionClosed:
assert False, 'Connection closed without ERROR.'
self.assertIn('ERROR', commands,
fail_msg='Did not receive ERROR as a reply to QUIT.')