Example #1
0
    def test_producer_consumer(self, mock__generate_random_name):
        scenario = basic.ZaqarBasic(self.context)
        messages = [{"body": {"id": idx}, "ttl": 360} for idx in range(20)]
        queue = mock.MagicMock()

        scenario._queue_create = mock.MagicMock(return_value=queue)
        scenario._messages_post = mock.MagicMock()
        scenario._messages_list = mock.MagicMock()
        scenario._queue_delete = mock.MagicMock()

        scenario.producer_consumer(name_length=10,
                                   min_msg_count=20,
                                   max_msg_count=20)

        scenario._queue_create.assert_called_once_with(name_length=10)
        scenario._messages_post.assert_called_once_with(
            queue, messages, 20, 20)
        scenario._messages_list.assert_called_once_with(queue)
        scenario._queue_delete.assert_called_once_with(queue)
Example #2
0
 def test_create_queue(self, mock__generate_random_name):
     scenario = basic.ZaqarBasic(self.context)
     scenario._queue_create = mock.MagicMock()
     scenario.create_queue(name_length=10)
     scenario._queue_create.assert_called_once_with(name_length=10)
Example #3
0
 def test_create_queue(self, mock_generate_random_name):
     scenario = basic.ZaqarBasic(self.context)
     scenario._queue_create = mock.MagicMock()
     scenario.create_queue(fakearg="fake")
     scenario._queue_create.assert_called_once_with(fakearg="fake")