Skip to content

Commit

Permalink
Added a test.
Browse files Browse the repository at this point in the history
  • Loading branch information
thedrow authored and auvipy committed Sep 11, 2019
1 parent 86cb254 commit a797885
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions t/unit/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
import warnings

import pytest
from case import ContextMock, Mock, call, patch

from amqp import Connection, spec
from amqp.connection import SSLError
from amqp.exceptions import ConnectionError, NotFound, ResourceError
from amqp.exceptions import (ConnectionError, NotFound,
RecoverableConnectionError, ResourceError)
from amqp.five import items
from amqp.sasl import AMQPLAIN, EXTERNAL, GSSAPI, PLAIN, SASL
from amqp.transport import TCPTransport
from case import ContextMock, Mock, call, patch


class test_Connection:
Expand Down Expand Up @@ -417,6 +418,11 @@ def test_on_inbound_method(self):
(50, 60), 'payload', 'content',
)

def test_on_inbound_method_when_connection_is_closed(self):
self.conn.collect()
with pytest.raises(RecoverableConnectionError):
self.conn.on_inbound_method(1, (50, 60), 'payload', 'content')

def test_close(self):
self.conn.collect = Mock(name='collect')
self.conn.close(reply_text='foo', method_sig=spec.Channel.Open)
Expand Down

0 comments on commit a797885

Please sign in to comment.