Beispiel #1
0
    def test_custom_headers(self):
        test_headers = {'X-Test-Header': 'TEST'}
        base_headers = self.make_req.headers
        base_headers.update(test_headers)

        config = {'headers': test_headers}
        make_request = http.MakeRequest(config=config)
        self.assertEqual(base_headers, make_request.headers)
Beispiel #2
0
    def setUp(self):
        self.url = 'http://example.com'

        self.logger_patched = mock.patch('cloudlib.http.logger.getLogger')
        self.logger = self.logger_patched.start()
        self.logger.return_value = tests.Logger()

        self.make_req = http.MakeRequest()
        self.fakehttp = tests.FakeHttp()
Beispiel #3
0
    def __init__(self, job_args):
        """

        :param job_args:
        """
        self.job_args = job_args
        self.http = http.MakeRequest()
        self.shell = shell.ShellCommands(log_name='turbolift',
                                         debug=self.job_args.get('debug'))
Beispiel #4
0
 def test_timeout_set(self):
     config = {'timeout': 120}
     make_request = http.MakeRequest(config=config)
     timeout = make_request.request_kwargs['timeout']
     self.assertEqual(config['timeout'], timeout)
Beispiel #5
0
 def test_enable_debug(self):
     config = {'debug': True}
     http.MakeRequest(config=config)
     debug_level = http.httplib.HTTPConnection.debuglevel
     self.assertEqual(1, debug_level)
     http.httplib.HTTPConnection.debuglevel = 0
Beispiel #6
0
 def __init__(self, job_args):
     self.job_args = job_args
     self.req = http.MakeRequest()