'Test if encode_body() works when encoding is set correctly'

@patch((QPID_MODULE + u'.Channel.codecs'))
def test_encode_body_expected_encoding(self, mock_codecs):

    mock_body = Mock()
    mock_encoder = Mock()
    mock_encoded_result = Mock()
    mock_codecs.get.return_value = mock_encoder
    mock_encoder.encode.return_value = mock_encoded_result
    result = self.my_channel.encode_body(mock_body, encoding=u'base64')
    expected_result = (mock_encoded_result, u'base64')
    assert (expected_result == result)
