コード例 #1
0
ファイル: channel_test.py プロジェクト: liorn/haigha
    def test_properties(self):
        connection = mock()
        connection.logger = 'logger'
        connection.synchronous = False

        c = Channel(connection, 'id', {})
        c._closed = 'yes'
        c._close_info = 'ithappened'
        c._active = 'record'

        assert_equals(connection, c.connection)
        assert_equals('id', c.channel_id)
        assert_equals('logger', c.logger)
        assert_equals('yes', c.closed)
        assert_equals('ithappened', c.close_info)
        assert_equals('record', c.active)
        assert_false(c.synchronous)

        c._closed = False
        assert_equals(None, c.close_info)

        connection.synchronous = False
        c = Channel(connection, 'id', {}, synchronous=True)
        assert_true(c.synchronous)

        connection.synchronous = True
        c = Channel(connection, 'id', {})
        assert_true(c.synchronous)

        connection.synchronous = True
        c = Channel(connection, 'id', {}, synchronous=False)
        assert_true(c.synchronous)
コード例 #2
0
    def test_properties(self):
        connection = mock()
        connection.logger = 'logger'
        connection.synchronous = False

        c = Channel(connection, 'id', {})
        c._closed = 'yes'
        c._close_info = 'ithappened'
        c._active = 'record'

        assert_equals(connection, c.connection)
        assert_equals('id', c.channel_id)
        assert_equals('logger', c.logger)
        assert_equals('yes', c.closed)
        assert_equals('ithappened', c.close_info)
        assert_equals('record', c.active)
        assert_false(c.synchronous)

        c._closed = False
        assert_equals(None, c.close_info)

        connection.synchronous = False
        c = Channel(connection, 'id', {}, synchronous=True)
        assert_true(c.synchronous)

        connection.synchronous = True
        c = Channel(connection, 'id', {})
        assert_true(c.synchronous)

        connection.synchronous = True
        c = Channel(connection, 'id', {}, synchronous=False)
        assert_true(c.synchronous)
コード例 #3
0
ファイル: channel_test.py プロジェクト: liorn/haigha
    def test_send_frame_when_not_closed_and_flow_control(self):
        conn = mock()
        c = Channel(conn, 32, {})
        c._active = False

        method = MethodFrame(1, 2, 3)
        heartbeat = HeartbeatFrame()
        header = HeaderFrame(1, 2, 3, 4)
        content = ContentFrame(1, 'foo')

        expect(conn.send_frame).args(method)
        expect(conn.send_frame).args(heartbeat)

        c.send_frame(method)
        c.send_frame(heartbeat)
        assert_raises(Channel.Inactive, c.send_frame, header)
        assert_raises(Channel.Inactive, c.send_frame, content)
コード例 #4
0
ファイル: channel_test.py プロジェクト: widgital/haigha
    def test_send_frame_when_not_closed_and_flow_control(self):
        conn = mock()
        c = Channel(conn, 32, {})
        c._active = False

        method = MethodFrame(1, 2, 3)
        heartbeat = HeartbeatFrame()
        header = HeaderFrame(1, 2, 3, 4)
        content = ContentFrame(1, 'foo')

        expect(conn.send_frame).args(method)
        expect(conn.send_frame).args(heartbeat)

        c.send_frame(method)
        c.send_frame(heartbeat)
        self.assertRaises(Channel.Inactive, c.send_frame, header)
        self.assertRaises(Channel.Inactive, c.send_frame, content)
コード例 #5
0
ファイル: channel_test.py プロジェクト: widgital/haigha
    def test_properties(self):
        connection = mock()
        connection.logger = 'logger'

        c = Channel(connection, 'id', {})
        c._closed = 'yes'
        c._close_info = 'ithappened'
        c._active = 'record'

        assertEquals(connection, c.connection)
        assertEquals('id', c.channel_id)
        assertEquals('logger', c.logger)
        assert_equals('yes', c.closed)
        assert_equals('ithappened', c.close_info)
        assert_equals('record', c.active)

        c._closed = False
        assert_equals(None, c.close_info)
コード例 #6
0
ファイル: channel_test.py プロジェクト: bkjones/haigha
    def test_properties(self):
        connection = mock()
        connection.logger = "logger"

        c = Channel(connection, "id", {})
        c._closed = "yes"
        c._close_info = "ithappened"
        c._active = "record"

        assertEquals(connection, c.connection)
        assertEquals("id", c.channel_id)
        assertEquals("logger", c.logger)
        assert_equals("yes", c.closed)
        assert_equals("ithappened", c.close_info)
        assert_equals("record", c.active)

        c._closed = False
        assert_equals(None, c.close_info)
コード例 #7
0
ファイル: channel_test.py プロジェクト: joeyimbasciano/haigha
  def test_properties(self):
    connection = mock()
    connection.logger = 'logger'

    c = Channel(connection, 'id', {})
    c._closed = 'yes'
    c._close_info = 'ithappened'
    c._active = 'record'

    assertEquals( connection, c.connection )
    assertEquals( 'id', c.channel_id )
    assertEquals( 'logger', c.logger )
    assert_equals( 'yes', c.closed )
    assert_equals( 'ithappened', c.close_info )
    assert_equals( 'record', c.active )
    
    c._closed = False
    assert_equals( None, c.close_info )