oslo.vmware/oslo_vmware/tests
Stephen Finucane e991194cbd Don't use 'requests.PreparedRequest'
We're using 'requests.PreparedRequest' in one place in the tests.
However, the requests docs have a warning that one shouldn't do this:

  Instances are generated from a Request object, and should not be
  instantiated manually; doing so may produce undesirable effects.

It seems we're now seeing just such an effect, as requests has started
attempting to do proxy-related things resulting in the following error:

    Traceback (most recent call last):
      File "/usr/lib64/python3.6/unittest/mock.py", line 1183, in patched
    return func(*args, **keywargs)
      File ".../oslo.vmware/oslo_vmware/tests/test_service.py", line 518, in test_send_with_local_file_url
    resp = transport.session.send(request)
      File ".../oslo.vmware/.tox/py36/lib/python3.6/site-packages/requests/sessions.py", line 636, in send
    kwargs.setdefault('proxies', self.rebuild_proxies(request, self.proxies))
      File ".../oslo.vmware/.tox/py36/lib/python3.6/site-packages/requests/sessions.py", line 301, in rebuild_proxies
    if 'Proxy-Authorization' in headers:
    TypeError: argument of type 'NoneType' is not iterable

Do what we should have done from the beginning and use
'requests.Request.prepare' instead.

[1] https://docs.python-requests.org/en/master/api/#requests.PreparedRequest

Change-Id: I072c64904298cf83cb113e402d85fb62626f39f7
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-09-21 15:41:58 +01:00
..
objects Add moref helper functions 2020-07-09 12:16:32 +02:00
__init__.py Files with no code must be left completely empty 2016-11-28 13:42:21 +07:00
base.py Move files out of the namespace package 2015-01-12 13:22:13 -05:00
test.ovf Support download of virtual disk in ova container 2016-05-19 22:45:40 -07:00
test_api.py Add moref helper functions 2020-07-09 12:16:32 +02:00
test_dvs_util.py Add moref helper functions 2020-07-09 12:16:32 +02:00
test_exceptions.py Use unittest.mock instead of third party mock 2020-03-31 14:37:19 -05:00
test_hacking.py Add hacking rule to prevent log translations 2017-07-03 02:47:10 -04:00
test_image_transfer.py Use unittest.mock instead of third party mock 2020-03-31 14:37:19 -05:00
test_image_util.py Support download of virtual disk in ova container 2016-05-19 22:45:40 -07:00
test_pbm.py Add moref helper functions 2020-07-09 12:16:32 +02:00
test_rw_handles.py Add backend-independent access to cookiejar 2020-07-14 10:03:41 +02:00
test_service.py Don't use 'requests.PreparedRequest' 2021-09-21 15:41:58 +01:00
test_vim.py Add backend-independent access to cookiejar 2020-07-14 10:03:41 +02:00
test_vim_util.py Add serialize_object() helper function 2021-04-16 11:05:02 +02:00