'Test publisher post.'

@mock.patch('zaqarclient.queues.v2.queues.Queue')
def test_zaqar_post_events(self, mock_queue):

    parsed_url = urlparse.urlparse('zaqar://?queue=foo')
    publisher = zaqar.ZaqarPublisher(self.CONF, parsed_url)
    mock_post = mock.Mock()
    mock_queue.return_value = mock_post
    publisher.publish_events(self.event_data)
    mock_queue.assert_called_once_with(mock.ANY, 'foo')
    self.assertEqual(3, len(mock_post.post.call_args_list[0][0][0]))
    self.assertEqual(mock_post.post.call_args_list[0][0][0][0]['body'], self.event_data[0].serialize())
