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>