Hello community,
here is the log from the commit of package python-requests-file for
openSUSE:Factory checked in at 2020-08-06 10:40:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-requests-file (Old)
and /work/SRC/openSUSE:Factory/.python-requests-file.new.3399 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-requests-file"
Thu Aug 6 10:40:50 2020 rev:3 rq:824572 version:1.5.1
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-requests-file/python-requests-file.changes
2018-12-24 11:43:13.561354559 +0100
+++
/work/SRC/openSUSE:Factory/.python-requests-file.new.3399/python-requests-file.changes
2020-08-06 10:41:23.370098081 +0200
@@ -1,0 +2,10 @@
+Mon Aug 3 10:42:35 UTC 2020 - Marketa Calabkova <[email protected]>
+
+- update to 1.5.1
+ * Fix python 2.7 compatibility
+ * Rename test file for pytest
+ * Add tests via github actions
+ * Format code with black
+ * Add set_content_length flag to disable on demand setting Content-Length
+
+-------------------------------------------------------------------
Old:
----
requests-file-1.4.3.tar.gz
New:
----
requests-file-1.5.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-requests-file.spec ++++++
--- /var/tmp/diff_new_pack.cFHoCu/_old 2020-08-06 10:41:34.194103502 +0200
+++ /var/tmp/diff_new_pack.cFHoCu/_new 2020-08-06 10:41:34.198103504 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python-requests-file
#
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -19,12 +19,12 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%bcond_without tests
Name: python-requests-file
-Version: 1.4.3
+Version: 1.5.1
Release: 0
Summary: File transport adapter for Requests
License: Apache-2.0
Group: Development/Languages/Python
-URL: http://github.com/dashea/requests-file
+URL: https://github.com/dashea/requests-file
Source:
https://files.pythonhosted.org/packages/source/r/requests-file/requests-file-%{version}.tar.gz
BuildRequires: %{python_module requests}
BuildRequires: %{python_module setuptools}
@@ -50,7 +50,7 @@
%if %{with tests}
%check
-%python_exec setup.py test
+%python_exec -m unittest discover tests
%endif
%files %{python_files}
++++++ requests-file-1.4.3.tar.gz -> requests-file-1.5.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-file-1.4.3/PKG-INFO
new/requests-file-1.5.1/PKG-INFO
--- old/requests-file-1.4.3/PKG-INFO 2018-01-02 22:15:28.000000000 +0100
+++ new/requests-file-1.5.1/PKG-INFO 2020-04-25 15:55:08.913671000 +0200
@@ -1,12 +1,11 @@
Metadata-Version: 1.1
Name: requests-file
-Version: 1.4.3
+Version: 1.5.1
Summary: File transport adapter for Requests
Home-page: http://github.com/dashea/requests-file
Author: David Shea
-Author-email: [email protected]
+Author-email: [email protected]
License: Apache 2.0
-Description-Content-Type: UNKNOWN
Description: UNKNOWN
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
@@ -14,4 +13,4 @@
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-file-1.4.3/requests_file.egg-info/PKG-INFO
new/requests-file-1.5.1/requests_file.egg-info/PKG-INFO
--- old/requests-file-1.4.3/requests_file.egg-info/PKG-INFO 2018-01-02
22:15:28.000000000 +0100
+++ new/requests-file-1.5.1/requests_file.egg-info/PKG-INFO 2020-04-25
15:55:08.000000000 +0200
@@ -1,12 +1,11 @@
Metadata-Version: 1.1
Name: requests-file
-Version: 1.4.3
+Version: 1.5.1
Summary: File transport adapter for Requests
Home-page: http://github.com/dashea/requests-file
Author: David Shea
-Author-email: [email protected]
+Author-email: [email protected]
License: Apache 2.0
-Description-Content-Type: UNKNOWN
Description: UNKNOWN
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
@@ -14,4 +13,4 @@
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/requests-file-1.4.3/requests_file.egg-info/SOURCES.txt
new/requests-file-1.5.1/requests_file.egg-info/SOURCES.txt
--- old/requests-file-1.4.3/requests_file.egg-info/SOURCES.txt 2018-01-02
22:15:28.000000000 +0100
+++ new/requests-file-1.5.1/requests_file.egg-info/SOURCES.txt 2020-04-25
15:55:08.000000000 +0200
@@ -10,4 +10,4 @@
requests_file.egg-info/dependency_links.txt
requests_file.egg-info/requires.txt
requests_file.egg-info/top_level.txt
-tests/__init__.py
\ No newline at end of file
+tests/test_requests_file.py
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-file-1.4.3/requests_file.py
new/requests-file-1.5.1/requests_file.py
--- old/requests-file-1.4.3/requests_file.py 2018-01-02 21:34:47.000000000
+0100
+++ new/requests-file-1.5.1/requests_file.py 2020-04-25 15:49:02.000000000
+0200
@@ -9,7 +9,12 @@
from six import BytesIO
+
class FileAdapter(BaseAdapter):
+ def __init__(self, set_content_length=True):
+ super(FileAdapter, self).__init__()
+ self._set_content_length = set_content_length
+
def send(self, request, **kwargs):
""" Wraps a file, described in request, in a Response object.
@@ -36,7 +41,7 @@
try:
# Split the path on / (the URL directory separator) and decode any
# % escapes in the parts
- path_parts = [unquote(p) for p in url_parts.path.split('/')]
+ path_parts = [unquote(p) for p in url_parts.path.split("/")]
# Strip out the leading empty parts created from the leading /'s
while path_parts and not path_parts[0]:
@@ -51,16 +56,17 @@
# so that a directory separator can correctly be added to the real
# path, and remove any empty path parts between the drive and the
path.
# Assume that a part ending with : or | (legacy) is a drive.
- if path_parts and (path_parts[0].endswith('|') or
- path_parts[0].endswith(':')):
+ if path_parts and (
+ path_parts[0].endswith("|") or path_parts[0].endswith(":")
+ ):
path_drive = path_parts.pop(0)
- if path_drive.endswith('|'):
- path_drive = path_drive[:-1] + ':'
+ if path_drive.endswith("|"):
+ path_drive = path_drive[:-1] + ":"
while path_parts and not path_parts[0]:
path_parts.pop(0)
else:
- path_drive = ''
+ path_drive = ""
# Try to put the path back together
# Join the drive back in, and stick os.sep in front of the path to
@@ -91,7 +97,8 @@
# representation of the exception into a byte stream
resp_str = str(e).encode(locale.getpreferredencoding(False))
resp.raw = BytesIO(resp_str)
- resp.headers['Content-Length'] = len(resp_str)
+ if self._set_content_length:
+ resp.headers["Content-Length"] = len(resp_str)
# Add release_conn to the BytesIO object
resp.raw.release_conn = resp.raw.close
@@ -101,8 +108,8 @@
# If it's a regular file, set the Content-Length
resp_stat = os.fstat(resp.raw.fileno())
- if stat.S_ISREG(resp_stat.st_mode):
- resp.headers['Content-Length'] = resp_stat.st_size
+ if stat.S_ISREG(resp_stat.st_mode) and self._set_content_length:
+ resp.headers["Content-Length"] = resp_stat.st_size
return resp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-file-1.4.3/setup.py
new/requests-file-1.5.1/setup.py
--- old/requests-file-1.4.3/setup.py 2018-01-02 22:14:12.000000000 +0100
+++ new/requests-file-1.5.1/setup.py 2020-04-25 15:51:47.000000000 +0200
@@ -1,7 +1,5 @@
#!/usr/bin/env python
-import os
-
try:
from setuptools import setup
except ImportError:
@@ -10,21 +8,22 @@
requires = [line.strip() for line in open("requirements.txt").readlines()]
setup(
- name='requests-file',
- version='1.4.3',
- description='File transport adapter for Requests',
- author='David Shea',
- author_email='[email protected]',
- url='http://github.com/dashea/requests-file',
- py_modules=['requests_file'],
+ name="requests-file",
+ version="1.5.1",
+ description="File transport adapter for Requests",
+ author="David Shea",
+ author_email="[email protected]",
+ url="http://github.com/dashea/requests-file",
+ py_modules=["requests_file"],
install_requires=requires,
- license='Apache 2.0',
- test_suite='tests',
- classifiers=['Development Status :: 3 - Alpha',
- 'Environment :: Plugins',
- 'Intended Audience :: Developers',
- 'License :: OSI Approved :: Apache Software License',
- 'Programming Language :: Python :: 2.7',
- 'Programming Language :: Python :: 3.4'
- ]
- )
+ license="Apache 2.0",
+ test_suite="tests",
+ classifiers=[
+ "Development Status :: 3 - Alpha",
+ "Environment :: Plugins",
+ "Intended Audience :: Developers",
+ "License :: OSI Approved :: Apache Software License",
+ "Programming Language :: Python :: 2.7",
+ "Programming Language :: Python :: 3",
+ ],
+)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-file-1.4.3/tests/__init__.py
new/requests-file-1.5.1/tests/__init__.py
--- old/requests-file-1.4.3/tests/__init__.py 2018-01-02 21:47:14.000000000
+0100
+++ new/requests-file-1.5.1/tests/__init__.py 1970-01-01 01:00:00.000000000
+0100
@@ -1,168 +0,0 @@
-import unittest
-import requests
-from requests_file import FileAdapter
-
-import os, stat
-import tempfile
-import shutil
-import platform
-
-class FileRequestTestCase(unittest.TestCase):
- def setUp(self):
- self._session = requests.Session()
- self._session.mount("file://", FileAdapter())
-
- def _pathToURL(self, path):
- """Convert a filesystem path to a URL path"""
- urldrive, urlpath = os.path.splitdrive(path)
-
- # Split the path on the os spearator and recombine it with / as the
- # separator. There probably aren't any OS's that allow / as a path
- # component, but just in case, encode any remaining /'s.
- urlsplit = (part.replace('/', '%2F') for part in urlpath.split(os.sep))
- urlpath = "/".join(urlsplit)
-
- # Encode /'s in the drive for the imaginary case where that can be a
thing
- urldrive = urldrive.replace('/', '%2F')
-
- # Add the leading /. If there is a drive component, this needs to be
- # placed before the drive.
- urldrive = "/" + urldrive
-
- return urldrive + urlpath
-
- def test_fetch_regular(self):
- # Fetch this file using requests
- with open(__file__, "rb") as f:
- testdata = f.read()
- response = self._session.get("file://%s" %
self._pathToURL(os.path.abspath(__file__)))
-
- self.assertEqual(response.status_code, requests.codes.ok)
- self.assertEqual(response.headers['Content-Length'], len(testdata))
- self.assertEqual(response.content, testdata)
-
- response.close()
-
- def test_fetch_missing(self):
- # Fetch a file that (hopefully) doesn't exist, look for a 404
- response = self._session.get("file:///no/such/path")
- self.assertEqual(response.status_code, requests.codes.not_found)
- self.assertTrue(response.text)
- response.close()
-
- @unittest.skipIf(hasattr(os, "geteuid") and os.geteuid() == 0,
- "Skipping permissions test since running as root")
- def test_fetch_no_access(self):
- # Create a file and remove read permissions, try to get a 403
- # probably doesn't work on windows
- with tempfile.NamedTemporaryFile() as tmp:
- os.chmod(tmp.name, 0)
- response = self._session.get("file://%s" %
self._pathToURL(os.path.abspath(tmp.name)))
-
- self.assertEqual(response.status_code, requests.codes.forbidden)
- self.assertTrue(response.text)
-
- response.close()
-
- @unittest.skipIf(platform.system() == "Windows",
- "skipping locale test on windows")
- def test_fetch_missing_localized(self):
- # Make sure translated error messages don't cause any problems
- import locale
-
- saved_locale = locale.setlocale(locale.LC_MESSAGES, None)
- try:
- locale.setlocale(locale.LC_MESSAGES, 'ru_RU.UTF-8')
- response = self._session.get("file:///no/such/path")
- self.assertEqual(response.status_code, requests.codes.not_found)
- self.assertTrue(response.text)
- response.close()
- except locale.Error:
- unittest.SkipTest('ru_RU.UTF-8 locale not available')
- finally:
- locale.setlocale(locale.LC_MESSAGES, saved_locale)
-
- def test_head(self):
- # Check that HEAD returns the content-length
- testlen = os.stat(__file__).st_size
- response = self._session.head("file://%s" %
self._pathToURL(os.path.abspath(__file__)))
-
- self.assertEqual(response.status_code, requests.codes.ok)
- self.assertEqual(response.headers['Content-Length'], testlen)
-
- response.close()
-
- def test_fetch_post(self):
- # Make sure that non-GET methods are rejected
- self.assertRaises(ValueError, self._session.post,
- ("file://%s" % self._pathToURL(os.path.abspath(__file__))))
-
- def test_fetch_nonlocal(self):
- # Make sure that network locations are rejected
- self.assertRaises(ValueError, self._session.get,
- ("file://example.com%s" %
self._pathToURL(os.path.abspath(__file__))))
- self.assertRaises(ValueError, self._session.get,
- ("file://localhost:8080%s" %
self._pathToURL(os.path.abspath(__file__))))
-
- # localhost is ok, though
- with open(__file__, "rb") as f:
- testdata = f.read()
- response = self._session.get("file://localhost%s" %
self._pathToURL(os.path.abspath(__file__)))
- self.assertEqual(response.status_code, requests.codes.ok)
- self.assertEqual(response.content, testdata)
- response.close()
-
- def test_funny_names(self):
- testdata = 'yo wassup man\n'.encode('ascii')
- tmpdir = tempfile.mkdtemp()
-
- try:
- with open(os.path.join(tmpdir, 'spa ces'), "w+b") as space_file:
- space_file.write(testdata)
- space_file.flush()
- response = self._session.get("file://%s/spa%%20ces" %
self._pathToURL(tmpdir))
- self.assertEqual(response.status_code, requests.codes.ok)
- self.assertEqual(response.content, testdata)
- response.close()
-
- with open(os.path.join(tmpdir, 'per%cent'), "w+b") as percent_file:
- percent_file.write(testdata)
- percent_file.flush()
- response = self._session.get("file://%s/per%%25cent" %
self._pathToURL(tmpdir))
- self.assertEqual(response.status_code, requests.codes.ok)
- self.assertEqual(response.content, testdata)
- response.close()
-
- # percent-encoded directory separators should be rejected
- with open(os.path.join(tmpdir, 'badname'), "w+b") as bad_file:
- response = self._session.get("file://%s%%%Xbadname" %
(self._pathToURL(tmpdir), ord(os.sep)))
- self.assertEqual(response.status_code,
requests.codes.not_found)
- response.close()
-
- finally:
- shutil.rmtree(tmpdir)
-
- def test_close(self):
- # Open a request for this file
- response = self._session.get("file://%s" %
self._pathToURL(os.path.abspath(__file__)))
-
- # Try closing it
- response.close()
-
- def test_missing_close(self):
- # Make sure non-200 responses can be closed
- response = self._session.get("file:///no/such/path")
- response.close()
-
- @unittest.skipIf(platform.system() != "Windows", "skipping windows URL
test")
- def test_windows_legacy(self):
- """Test |-encoded drive characters on Windows"""
- with open(__file__, "rb") as f:
- testdata = f.read()
-
- drive, path = os.path.splitdrive(os.path.abspath(__file__))
- response = self._session.get("file:///%s|%s" % (drive[:-1],
path.replace(os.sep, "/")))
- self.assertEqual(response.status_code, requests.codes.ok)
- self.assertEqual(response.headers['Content-Length'], len(testdata))
- self.assertEqual(response.content, testdata)
- response.close()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-file-1.4.3/tests/test_requests_file.py
new/requests-file-1.5.1/tests/test_requests_file.py
--- old/requests-file-1.4.3/tests/test_requests_file.py 1970-01-01
01:00:00.000000000 +0100
+++ new/requests-file-1.5.1/tests/test_requests_file.py 2020-04-25
15:49:02.000000000 +0200
@@ -0,0 +1,197 @@
+import unittest
+import requests
+from requests_file import FileAdapter
+
+import os, stat
+import tempfile
+import shutil
+import platform
+
+
+class FileRequestTestCase(unittest.TestCase):
+ def setUp(self):
+ self._session = requests.Session()
+ self._session.mount("file://", FileAdapter())
+
+ def _pathToURL(self, path):
+ """Convert a filesystem path to a URL path"""
+ urldrive, urlpath = os.path.splitdrive(path)
+
+ # Split the path on the os spearator and recombine it with / as the
+ # separator. There probably aren't any OS's that allow / as a path
+ # component, but just in case, encode any remaining /'s.
+ urlsplit = (part.replace("/", "%2F") for part in urlpath.split(os.sep))
+ urlpath = "/".join(urlsplit)
+
+ # Encode /'s in the drive for the imaginary case where that can be a
thing
+ urldrive = urldrive.replace("/", "%2F")
+
+ # Add the leading /. If there is a drive component, this needs to be
+ # placed before the drive.
+ urldrive = "/" + urldrive
+
+ return urldrive + urlpath
+
+ def test_fetch_regular(self):
+ # Fetch this file using requests
+ with open(__file__, "rb") as f:
+ testdata = f.read()
+ response = self._session.get(
+ "file://%s" % self._pathToURL(os.path.abspath(__file__))
+ )
+
+ self.assertEqual(response.status_code, requests.codes.ok)
+ self.assertEqual(response.headers["Content-Length"], len(testdata))
+ self.assertEqual(response.content, testdata)
+
+ response.close()
+
+ def test_fetch_missing(self):
+ # Fetch a file that (hopefully) doesn't exist, look for a 404
+ response = self._session.get("file:///no/such/path")
+ self.assertEqual(response.status_code, requests.codes.not_found)
+ self.assertTrue(response.text)
+ response.close()
+
+ @unittest.skipIf(
+ hasattr(os, "geteuid") and os.geteuid() == 0,
+ "Skipping permissions test since running as root",
+ )
+ def test_fetch_no_access(self):
+ # Create a file and remove read permissions, try to get a 403
+ # probably doesn't work on windows
+ with tempfile.NamedTemporaryFile() as tmp:
+ os.chmod(tmp.name, 0)
+ response = self._session.get(
+ "file://%s" % self._pathToURL(os.path.abspath(tmp.name))
+ )
+
+ self.assertEqual(response.status_code, requests.codes.forbidden)
+ self.assertTrue(response.text)
+
+ response.close()
+
+ @unittest.skipIf(platform.system() == "Windows", "skipping locale test on
windows")
+ def test_fetch_missing_localized(self):
+ # Make sure translated error messages don't cause any problems
+ import locale
+
+ saved_locale = locale.setlocale(locale.LC_MESSAGES, None)
+ try:
+ locale.setlocale(locale.LC_MESSAGES, "ru_RU.UTF-8")
+ response = self._session.get("file:///no/such/path")
+ self.assertEqual(response.status_code, requests.codes.not_found)
+ self.assertTrue(response.text)
+ response.close()
+ except locale.Error:
+ unittest.SkipTest("ru_RU.UTF-8 locale not available")
+ finally:
+ locale.setlocale(locale.LC_MESSAGES, saved_locale)
+
+ def test_head(self):
+ # Check that HEAD returns the content-length
+ testlen = os.stat(__file__).st_size
+ response = self._session.head(
+ "file://%s" % self._pathToURL(os.path.abspath(__file__))
+ )
+
+ self.assertEqual(response.status_code, requests.codes.ok)
+ self.assertEqual(response.headers["Content-Length"], testlen)
+
+ response.close()
+
+ def test_fetch_post(self):
+ # Make sure that non-GET methods are rejected
+ self.assertRaises(
+ ValueError,
+ self._session.post,
+ ("file://%s" % self._pathToURL(os.path.abspath(__file__))),
+ )
+
+ def test_fetch_nonlocal(self):
+ # Make sure that network locations are rejected
+ self.assertRaises(
+ ValueError,
+ self._session.get,
+ ("file://example.com%s" %
self._pathToURL(os.path.abspath(__file__))),
+ )
+ self.assertRaises(
+ ValueError,
+ self._session.get,
+ ("file://localhost:8080%s" %
self._pathToURL(os.path.abspath(__file__))),
+ )
+
+ # localhost is ok, though
+ with open(__file__, "rb") as f:
+ testdata = f.read()
+ response = self._session.get(
+ "file://localhost%s" % self._pathToURL(os.path.abspath(__file__))
+ )
+ self.assertEqual(response.status_code, requests.codes.ok)
+ self.assertEqual(response.content, testdata)
+ response.close()
+
+ def test_funny_names(self):
+ testdata = "yo wassup man\n".encode("ascii")
+ tmpdir = tempfile.mkdtemp()
+
+ try:
+ with open(os.path.join(tmpdir, "spa ces"), "w+b") as space_file:
+ space_file.write(testdata)
+ space_file.flush()
+ response = self._session.get(
+ "file://%s/spa%%20ces" % self._pathToURL(tmpdir)
+ )
+ self.assertEqual(response.status_code, requests.codes.ok)
+ self.assertEqual(response.content, testdata)
+ response.close()
+
+ with open(os.path.join(tmpdir, "per%cent"), "w+b") as percent_file:
+ percent_file.write(testdata)
+ percent_file.flush()
+ response = self._session.get(
+ "file://%s/per%%25cent" % self._pathToURL(tmpdir)
+ )
+ self.assertEqual(response.status_code, requests.codes.ok)
+ self.assertEqual(response.content, testdata)
+ response.close()
+
+ # percent-encoded directory separators should be rejected
+ with open(os.path.join(tmpdir, "badname"), "w+b") as bad_file:
+ response = self._session.get(
+ "file://%s%%%Xbadname" % (self._pathToURL(tmpdir),
ord(os.sep))
+ )
+ self.assertEqual(response.status_code,
requests.codes.not_found)
+ response.close()
+
+ finally:
+ shutil.rmtree(tmpdir)
+
+ def test_close(self):
+ # Open a request for this file
+ response = self._session.get(
+ "file://%s" % self._pathToURL(os.path.abspath(__file__))
+ )
+
+ # Try closing it
+ response.close()
+
+ def test_missing_close(self):
+ # Make sure non-200 responses can be closed
+ response = self._session.get("file:///no/such/path")
+ response.close()
+
+ @unittest.skipIf(platform.system() != "Windows", "skipping windows URL
test")
+ def test_windows_legacy(self):
+ """Test |-encoded drive characters on Windows"""
+ with open(__file__, "rb") as f:
+ testdata = f.read()
+
+ drive, path = os.path.splitdrive(os.path.abspath(__file__))
+ response = self._session.get(
+ "file:///%s|%s" % (drive[:-1], path.replace(os.sep, "/"))
+ )
+ self.assertEqual(response.status_code, requests.codes.ok)
+ self.assertEqual(response.headers["Content-Length"], len(testdata))
+ self.assertEqual(response.content, testdata)
+ response.close()