/
exceptions_test.py
39 lines (29 loc) · 1.41 KB
/
exceptions_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""
Tests for pika.exceptions
"""
try:
import unittest2 as unittest
except ImportError:
import unittest
from pika import exceptions
class ExceptionTests(unittest.TestCase):
def test_amqp_connection_error_one_param_repr(self):
self.assertEqual(repr(exceptions.AMQPConnectionError(10)),
"No connection could be opened after 10 connection attempts")
def test_amqp_connection_error_two_params_repr(self):
self.assertEqual(repr(exceptions.AMQPConnectionError(1, 'Test')),
"1: Test")
def test_authentication_error_repr(self):
self.assertEqual(repr(exceptions.AuthenticationError('PLAIN')),
'Server and client could not negotiate use of the '
'PLAIN authentication mechanism')
def test_body_too_long_error_repr(self):
self.assertEqual(repr(exceptions.BodyTooLongError(100, 50)),
'Received too many bytes for a message delivery: '
'Received 100, expected 50' )
def test_invalid_minimum_frame_size_repr(self):
self.assertEqual(repr(exceptions.InvalidMinimumFrameSize()),
'AMQP Minimum Frame Size is 4096 Bytes')
def test_invalid_maximum_frame_size_repr(self):
self.assertEqual(repr(exceptions.InvalidMaximumFrameSize()),
'AMQP Maximum Frame Size is 131072 Bytes')