Esempio n. 1
0
    def test_send_frame_when_not_closed_no_flow_control_pending_event(self):
        conn = mock()
        c = Channel(conn, 32, {})
        c._pending_events.append('cb')

        c.send_frame('frame')
        assert_equals(deque(['cb', 'frame']), c._pending_events)
Esempio n. 2
0
    def test_send_frame_when_not_closed_no_flow_control_no_pending_events(self):
        conn = mock()
        c = Channel(conn, 32, {})

        expect(conn.send_frame).args('frame')

        c.send_frame('frame')
Esempio n. 3
0
    def test_send_frame_when_not_closed_no_flow_control_pending_event(self):
        conn = mock()
        c = Channel(conn, 32, {})
        c._pending_events.append('cb')

        c.send_frame('frame')
        self.assertEquals(deque(['cb', 'frame']), c._pending_events)
Esempio n. 4
0
    def test_send_frame_when_not_closed_no_flow_control_pending_event(self):
        conn = mock()
        c = Channel(conn, 32, {})
        c._pending_events.append("cb")

        c.send_frame("frame")
        self.assertEquals(deque(["cb", "frame"]), c._pending_events)
Esempio n. 5
0
  def test_send_frame_when_not_closed_no_flow_control_no_pending_events(self):
    conn = mock()
    c = Channel(conn, 32, {})

    expect( conn.send_frame ).args('frame')
    
    c.send_frame( 'frame' )
Esempio n. 6
0
    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)
Esempio n. 7
0
    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)