Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mosquito committed Nov 16, 2020
1 parent 0e2ed26 commit e4b0582
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
6 changes: 5 additions & 1 deletion aiormq/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import pamqp.frame
from pamqp import commands as spec
from pamqp.base import Frame
from pamqp.constants import REPLY_SUCCESS
from pamqp.header import ContentHeader
from pamqp.body import ContentBody

Expand Down Expand Up @@ -376,7 +377,10 @@ async def _on_close(self, exc=None) -> Optional[spec.Channel.CloseOk]:
result = None
if self.writer is not None:
result = await self.rpc(
spec.Channel.Close(reply_code=spec.REPLY_SUCCESS),
spec.Channel.Close(
reply_code=REPLY_SUCCESS,
class_id=0, method_id=0,
),
)
self.connection.channels.pop(self.number, None)

Expand Down
13 changes: 7 additions & 6 deletions tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ async def test_channel_reuse(amqp_connection: aiormq.Connection):
channel = await amqp_connection.channel(channel_number=1)
await channel.basic_qos(prefetch_count=1)
await channel.close()
del channel


async def test_channel_closed_reuse(amqp_connection: aiormq.Connection):
Expand Down Expand Up @@ -150,8 +151,8 @@ async def test_auth_plain(amqp_connection, loop):

assert auth == PlainAuth(amqp_connection).marshal()

auth_parts = auth.split(b"\x00")
assert auth_parts == [b"", b"guest", b"guest"]
auth_parts = auth.split("\x00")
assert auth_parts == ["", "guest", "guest"]

connection = aiormq.Connection(
amqp_connection.url.with_user("foo").with_password("bar"),
Expand All @@ -160,13 +161,13 @@ async def test_auth_plain(amqp_connection, loop):

auth = PlainAuth(connection).marshal()

auth_parts = auth.split(b"\x00")
assert auth_parts == [b"", b"foo", b"bar"]
auth_parts = auth.split("\x00")
assert auth_parts == ["", "foo", "bar"]

auth = PlainAuth(connection)
auth.value = b"boo"
auth.value = "boo"

assert auth.marshal() == b"boo"
assert auth.marshal() == "boo"


async def test_channel_closed(amqp_connection):
Expand Down

0 comments on commit e4b0582

Please sign in to comment.