Skip to content

Commit

Permalink
Fixed unit-test coverage failing from 30675f8
Browse files Browse the repository at this point in the history
  • Loading branch information
eandersson committed Apr 21, 2017
1 parent ba3f0d0 commit 41dad6e
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions amqpstorm/tests/unit/channel0/channel0_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_channel0_close_connection(self):
reply_code=200)
)

self.assertEqual(connection.exceptions, [])
self.assertFalse(connection.exceptions)
self.assertTrue(connection.is_closed)

def test_channel0_forcefully_closed_connection(self):
Expand All @@ -72,7 +72,7 @@ def test_channel0_send_start_ok(self):
channel = Channel0(connection)
channel._send_start_ok(Connection.Start(mechanisms=b'PLAIN'))

self.assertNotEqual(connection.frames_out, [])
self.assertTrue(connection.frames_out)

channel_id, frame_out = connection.frames_out.pop()

Expand All @@ -86,7 +86,7 @@ def test_channel0_send_tune_ok(self):
channel = Channel0(connection)
channel._send_tune_ok()

self.assertNotEqual(connection.frames_out, [])
self.assertTrue(connection.frames_out)

channel_id, frame_out = connection.frames_out.pop()

Expand All @@ -98,19 +98,26 @@ def test_channel0_send_heartbeat(self):
channel = Channel0(connection)
channel.send_heartbeat()

self.assertNotEqual(connection.frames_out, [])
self.assertTrue(connection.frames_out)

channel_id, frame_out = connection.frames_out.pop()

self.assertEqual(channel_id, 0)
self.assertIsInstance(frame_out, Heartbeat)

def test_channel0_do_not_send_heartbeat_when_connection_closed(self):
connection = FakeConnection(state=FakeConnection.CLOSED)
channel = Channel0(connection)
channel.send_heartbeat()

self.assertFalse(connection.frames_out)

def test_channel0_send_close_connection(self):
connection = FakeConnection()
channel = Channel0(connection)
channel.send_close_connection()

self.assertNotEqual(connection.frames_out, [])
self.assertTrue(connection.frames_out)

channel_id, frame_out = connection.frames_out.pop()

Expand Down

0 comments on commit 41dad6e

Please sign in to comment.