示例#1
0
    def test_patch_session_option_override(self):
        http = RequestsWrapper({}, {})
        options = {'auth': ('user', 'pass')}

        with mock.patch('datadog_checks.base.utils.http.RequestsWrapper.session'):
            http.patch('https://www.google.com', persist=True, auth=options['auth'])
            http.session.patch.assert_called_once_with('https://www.google.com', **options)
示例#2
0
    def test_patch(self):
        http = RequestsWrapper({}, {})

        with mock.patch('requests.patch'):
            http.patch('https://www.google.com')
            requests.patch.assert_called_once_with('https://www.google.com',
                                                   **http.options)
示例#3
0
    def test_patch_session(self):
        http = RequestsWrapper({'persist_connections': True}, {})

        with mock.patch(
                'datadog_checks.base.utils.http.RequestsWrapper.session'):
            http.patch('https://www.google.com')
            http.session.patch.assert_called_once_with(
                'https://www.google.com', **DEFAULT_OPTIONS)
示例#4
0
    def test_patch_option_override(self):
        http = RequestsWrapper({}, {})
        options = http.options.copy()
        options['auth'] = ('user', 'pass')

        with mock.patch('requests.patch'):
            http.patch('https://www.google.com', auth=options['auth'])
            requests.patch.assert_called_once_with('https://www.google.com', **options)