Beispiel #1
0
    def test_update(self, mock_gofer_agent):
        context = Mock()
        context.agent_id = "123"
        context.secret = "test-secret"
        context.url = "http://broker.com"
        context.transport = "qpid"
        context.authenticator = Mock()
        context.details = {"task_id": "4567"}
        context.reply_queue = "pulp.task"

        mock_agent = Mock()
        mock_gofer_agent.return_value = mock_agent
        mock_content = Mock()
        mock_agent.Content = Mock(return_value=mock_content)

        units = []
        options = {}

        Content.update(context, units, options)

        mock_gofer_agent.assert_called_with(
            context.agent_id,
            ctag=context.reply_queue,
            url=context.url,
            transport=context.transport,
            secret=context.secret,
            authenticator=context.authenticator,
            any=context.details,
        )

        mock_content.update.assert_called_with(units, options)
Beispiel #2
0
    def test_update(self, mock_gofer_agent):
        context = Mock()
        context.route = '123'
        context.secret = 'test-secret'
        context.url = 'http://broker.com'
        context.authenticator = Mock()
        context.details = {'task_id': '4567'}
        context.reply_queue = 'pulp.task'

        mock_agent = Mock()
        mock_gofer_agent.return_value = mock_agent
        mock_content = Mock()
        mock_agent.Content = Mock(return_value=mock_content)

        units = []
        options = {}

        Content.update(context, units, options)

        mock_gofer_agent.assert_called_with(
            context.url,
            context.route,
            reply=context.reply_queue,
            secret=context.secret,
            authenticator=context.authenticator,
            data=context.details)

        mock_content.update.assert_called_with(units, options)
Beispiel #3
0
    def test_update(self, _agent):
        context = Context()
        units = []
        options = {}

        # test
        Content.update(context, units, options)

        # validation
        context.__enter__.assert_called_once_with()
        self.assertTrue(context.__exit__.called)

        _agent.assert_called_with(
            context.url,
            context.address,
            reply=context.reply_queue,
            secret=context.secret,
            authenticator=context.authenticator,
            data=context.details)

        _agent.return_value.Content.return_value.update.assert_called_with(units, options)
Beispiel #4
0
    def test_update(self, _agent):
        context = Context()
        units = []
        options = {}

        # test
        Content.update(context, units, options)

        # validation
        context.__enter__.assert_called_once_with()
        self.assertTrue(context.__exit__.called)

        _agent.assert_called_with(context.url,
                                  context.address,
                                  reply=context.reply_queue,
                                  secret=context.secret,
                                  authenticator=context.authenticator,
                                  data=context.details)

        _agent.return_value.Content.return_value.update.assert_called_with(
            units, options)