'make sure the connect method sets the state and sends a frame'

@mock.patch('pika.frame.ProtocolHeader')
def test_on_connect_timer(self, frame_protocol_header):

    self.connection.connection_state = self.connection.CONNECTION_INIT
    self.connection._adapter_connect = mock.Mock(return_value=None)
    self.connection._send_frame = mock.Mock()
    frame_protocol_header.spec = frame.ProtocolHeader
    frame_protocol_header.return_value = 'frame    object'
    self.connection._on_connect_timer()
    self.assertEqual(self.connection.CONNECTION_PROTOCOL, self.connection.connection_state)
    self.connection._send_frame.assert_called_once_with('frame    object')
