diff --git a/.gitignore b/.gitignore
index 31720d3..e414f6b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,6 @@
.project
.pydevproject
/.settings/
-venv
-.idea
+.idea/
+venv/
build
diff --git a/.travis.yml b/.travis.yml
index 207751e..b8661df 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,6 @@
language: python
python:
- - "2.7"
+ - "3.7"
install:
- python setup.py develop
script:
diff --git a/README.rst b/README.rst
index 10648c5..2bb59e8 100644
--- a/README.rst
+++ b/README.rst
@@ -27,6 +27,8 @@ ____________
Release Notes
=============
+**Version 0.13 – TBD**
+ * Main version of Python is updated up to 3.7
**Version 0.12 - 21.06.2019**
* Added depth argument in copy method in client.py by https://github.com/JesperHakansson
diff --git a/setup.py b/setup.py
index 39eefa2..a716a14 100644
--- a/setup.py
+++ b/setup.py
@@ -49,7 +49,8 @@ setup(
requires=['python (>= 2.7.6)'],
install_requires=['requests', 'lxml', 'argcomplete'],
scripts=['wdc'],
- tests_require=['pytest', 'pyhamcrest', 'junit-xml', 'pytest-allure-adaptor'],
+ test_suite='tests',
+ tests_require=['pytest'],
cmdclass={'install': Install, 'test': Test},
description='WebDAV client, based on original package https://github.com/designerror/webdav-client-python but '
'uses requests instead of PyCURL',
@@ -73,6 +74,9 @@ setup(
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
+ 'Programming Language :: Python :: 3.5',
+ 'Programming Language :: Python :: 3.6',
+ 'Programming Language :: Python :: 3.7',
'Topic :: Internet',
'Topic :: Software Development :: Libraries :: Python Modules',
],
diff --git a/tests/conftest.py b/tests/conftest.py
deleted file mode 100644
index 723db66..0000000
--- a/tests/conftest.py
+++ /dev/null
@@ -1,32 +0,0 @@
-__author__ = 'designerror'
-
-from hamcrest.core.base_matcher import BaseMatcher
-from hamcrest.core.helpers.hasmethod import hasmethod
-
-class Valid(BaseMatcher):
- def _matches(self, item):
- return False if not hasmethod(item, 'valid') else item.valid()
-
-class NotValid(BaseMatcher):
- def _matches(self, item):
- return False if not hasmethod(item, 'valid') else not item.valid()
-
-class Success(BaseMatcher):
- def _matches(self, item):
- return item
-
-class NotSuccess(BaseMatcher):
- def _matches(self, item):
- return not item
-
-def valid():
- return Valid()
-
-def not_valid():
- return NotValid()
-
-def success():
- return Success()
-
-def not_success():
- return NotSuccess()
\ No newline at end of file
diff --git a/tests/response_dir.xml b/tests/response_dir.xml
new file mode 100644
index 0000000..c0e3a7b
--- /dev/null
+++ b/tests/response_dir.xml
@@ -0,0 +1,136 @@
+
+
+
+ /
+
+ HTTP/1.1 200 OK
+
+ 2012-04-04T20:00:00Z
+ disk
+ Wed, 04 Apr 2012 20:00:00 GMT
+
+
+
+
+
+
+
+ /test_dir/
+
+ HTTP/1.1 200 OK
+
+ 2018-05-10T07:31:13Z
+ test_dir
+ Thu, 10 May 2018 07:31:13 GMT
+
+
+
+
+
+
+
+ /%D0%93%D0%BE%D1%80%D1%8B.jpg
+
+ HTTP/1.1 200 OK
+
+ 1392851f0668017168ee4b5a59d66e7b
+ 2018-05-09T14:44:28Z
+ Горы.jpg
+ Wed, 09 May 2018 14:44:28 GMT
+ image/jpeg
+ 1762478
+
+
+
+
+
+ /%D0%97%D0%B8%D0%BC%D0%B0.jpg
+
+ HTTP/1.1 200 OK
+
+ a64146fee5e15b3b94c204e544426d43
+ 2018-05-09T14:44:28Z
+ Зима.jpg
+ Wed, 09 May 2018 14:44:28 GMT
+ image/jpeg
+ 1394575
+
+
+
+
+
+ /%D0%9C%D0%B8%D1%88%D0%BA%D0%B8.jpg
+
+ HTTP/1.1 200 OK
+
+ 569a1c98696050439b5b2a1ecfa52d19
+ 2018-05-09T14:44:27Z
+ Мишки.jpg
+ Wed, 09 May 2018 14:44:27 GMT
+ image/jpeg
+ 1555830
+
+
+
+
+
+ /%D0%9C%D0%BE%D1%80%D0%B5.jpg
+
+ HTTP/1.1 200 OK
+
+ ab903d9cab031eca2a8f12f37bbc9d37
+ 2018-05-09T14:44:27Z
+ Море.jpg
+ Wed, 09 May 2018 14:44:27 GMT
+ image/jpeg
+ 1080301
+
+
+
+
+
+ /%D0%9C%D0%BE%D1%81%D0%BA%D0%B2%D0%B0.jpg
+
+ HTTP/1.1 200 OK
+
+ d27d72a3059ad5ebed7a5470459d2670
+ 2018-05-09T14:44:27Z
+ Москва.jpg
+ Wed, 09 May 2018 14:44:27 GMT
+ image/jpeg
+ 1454228
+
+
+
+
+
+ /%D0%A1%D0%B0%D0%BD%D0%BA%D1%82-%D0%9F%D0%B5%D1%82%D0%B5%D1%80%D0%B1%D1%83%D1%80%D0%B3.jpg
+
+ HTTP/1.1 200 OK
+
+ f1abe3b27b410128623fd1ca00a45c29
+ 2018-05-09T14:44:27Z
+ Санкт-Петербург.jpg
+ Wed, 09 May 2018 14:44:27 GMT
+ image/jpeg
+ 2573704
+
+
+
+
+
+ /%D0%A5%D0%BB%D0%B5%D0%B1%D0%BD%D1%8B%D0%B5%20%D0%BA%D1%80%D0%BE%D1%88%D0%BA%D0%B8.mp4
+
+ HTTP/1.1 200 OK
+
+ ea977f513074d5524bee3638798183b9
+ 2018-05-09T14:44:28Z
+ Хлебные крошки.mp4
+ Wed, 09 May 2018 14:44:28 GMT
+ video/mp4
+ 31000079
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/test_client_unit.py b/tests/test_client_unit.py
index 7489895..fe38c79 100644
--- a/tests/test_client_unit.py
+++ b/tests/test_client_unit.py
@@ -24,7 +24,7 @@ class ClientTestCase(TestCase):
def test_create_free_space_request_content(self):
result = utils.create_free_space_request_content()
self.assertEqual(result, b'\n'
- b'')
+ b'')
def test_parse_free_space_response(self):
content = '/' \
@@ -55,7 +55,7 @@ class ClientTestCase(TestCase):
}
result = utils.create_get_property_request_content(option=option, )
self.assertEqual(result, b'\n'
- b'')
+ b'')
def test_create_get_property_request_content_name_only(self):
option = {
@@ -63,7 +63,7 @@ class ClientTestCase(TestCase):
}
result = utils.create_get_property_request_content(option=option)
self.assertEqual(result, b'\n'
- b'')
+ b'')
def test_parse_get_property_response(self):
content = '' \
@@ -81,7 +81,7 @@ class ClientTestCase(TestCase):
}
result = utils.create_set_property_batch_request_content(options=[option])
self.assertEqual(result, b'\n'
- b'aValue')
+ b'aValue')
def test_create_set_one_property_request_content_name_only(self):
option = {
@@ -89,7 +89,7 @@ class ClientTestCase(TestCase):
}
result = utils.create_set_property_batch_request_content(options=[option])
self.assertEqual(result, b'\n'
- b'')
+ b'')
def test_create_set_property_batch_request_content(self):
options = [
@@ -106,8 +106,8 @@ class ClientTestCase(TestCase):
]
result = utils.create_set_property_batch_request_content(options=options)
self.assertEqual(result, b'\n'
- b'aValueaValue2'
- b'')
+ b'aValueaValue2'
+ b'')
def test_create_set_property_batch_request_content_name_only(self):
options = [
@@ -120,8 +120,8 @@ class ClientTestCase(TestCase):
]
result = utils.create_set_property_batch_request_content(options=options)
self.assertEqual(result, b'\n'
- b''
- b'')
+ b''
+ b'')
def test_etree_to_string(self):
tree = ElementTree(Element('test'))
@@ -129,56 +129,14 @@ class ClientTestCase(TestCase):
self.assertEqual(result, b'\n')
def test_parse_is_dir_response_directory(self):
- content = '/HTTP/1.1 200 OK2012-04-04T20:00:00Z' \
- 'd:creationdate>diskWed, 04 Apr 2012 20:00:00 GMT' \
- '/test_dir/HTTP/1.1 200 OK2018-05-10T07:31:13Ztest_dirThu, 10 May 2018 07:31:13 GMT/%D0%93%D0%BE%D1%80%D1%8B.jpg' \
- 'HTTP/1.1 200 OK1392851f0668017168ee4b' \
- '5a59d66e7b2018-05-09T14:44:28ZГоры.jpg' \
- 'Wed, 09 May 2018 14:44:28 GMTimage/jpeg1762478' \
- '/%D0%97%D0%B8%D0%BC%D0%B0.jpgHTTP/1.1 200 OKa64146fee5e15b3b94c204e544426d432018-05-09T14:44:28ZЗима.jpgWed, 09 May 2018 14:44:28 GMTimage/jpeg' \
- '1394575/%D0%9C%D0%B8%D1%88%D0%BA%D0%B8.jpg<' \
- 'd:status>HTTP/1.1 200 OK569a1c98696050439b5b2a1ecfa52d19' \
- '2018-05-09T14:44:27ZМишки.jpgWed, 09 May 2018 14:44:27 GMTimage/jpeg1555830/%D0%9C%D0%BE%D1%80%D0%B5.jpgHTTP' \
- '/1.1 200 OKab903d9cab031eca2a8f12f37bbc9d372018-05-09T14:44:27ZМоре.jpg' \
- 'Wed, 09 May 2018 14:44:27 GMTimage/jpeg1080301' \
- '/%D0%9C%D0%BE%D1%81%D0%BA%D0%B2%D0%B0.jpgHTTP/1' \
- '.1 200 OKd27d72a3059ad5ebed7a5470459d26702018-05-09T14:44:27ZМосква.jpg' \
- 'Wed, 09 May 2018 14:44:27 GMTimage/jpeg1454228' \
- '/%D0%A1%D0%B0%D0%BD%D0%BA%D1%82-%D0%9F%D0%B5%D1%82%D0%B5%D1%80%D0%B1%D1%83%D1%' \
- '80%D0%B3.jpgHTTP/1.1 200 OKf1abe3b27b' \
- '410128623fd1ca00a45c292018-05-09T14:44:27ZСанкт-Петербург.jpgWed, 09 May 2018 14:44:27 GMTimage/jpeg2573704/%D0%A5%D0%BB%D0%B5%' \
- 'D0%B1%D0%BD%D1%8B%D0%B5%20%D0%BA%D1%80%D0%BE%D1%88%D0%BA%D0%B8.mp4H' \
- 'TTP/1.1 200 OKea977f513074d5524bee3638798183b92018-05-09T14:44:28ZХлебные крошки.mp4Wed, 09 May 2018 14:44:28 GMTvideo/mp431000079' \
- ''
+ f = open('./tests/response_dir.xml')
+ content = f.read()
path = '/test_dir'
hostname = 'https://webdav.yandex.ru'
- result = utils.parse_is_dir_response(content.encode('utf-8'), path, hostname)
+ result = utils.parse_is_dir_response(content, path, hostname)
self.assertTrue(result, 'It should be directory')
- def test_parse_is_dir_response_directory(self):
+ def test_parse_is_dir_response_file(self):
content = '/test_' \
'dir/HTTP/1.1 200 OK2018-05-10T07' \
':40:11Ztest_dirThu, 10 May 2018' \
diff --git a/tests/webdav/test_authenticate.py b/tests/webdav/test_authenticate.py
deleted file mode 100644
index c03e2b9..0000000
--- a/tests/webdav/test_authenticate.py
+++ /dev/null
@@ -1 +0,0 @@
-__author__ = 'designerror'
diff --git a/tests/webdav/test_connection.py b/tests/webdav/test_connection.py
deleted file mode 100644
index 445483f..0000000
--- a/tests/webdav/test_connection.py
+++ /dev/null
@@ -1,11 +0,0 @@
-__author__ = 'designerror'
-
-import allure
-#from hamcrest import *
-
-class TestRequiredOptions:
-
- def test_without_webdav_hostname(self):
- options = { 'webdav_server': "https://webdav.yandex.ru"}
- allure.attach('options', options.__str__())
- assert 1
diff --git a/tests/webdav/test_methods.py b/tests/webdav/test_methods.py
deleted file mode 100644
index c03e2b9..0000000
--- a/tests/webdav/test_methods.py
+++ /dev/null
@@ -1 +0,0 @@
-__author__ = 'designerror'
diff --git a/webdav3/client.py b/webdav3/client.py
index b62e860..d923bd1 100644
--- a/webdav3/client.py
+++ b/webdav3/client.py
@@ -959,6 +959,8 @@ class WebDavXmlUtils:
:return: XML object of response for the remote resource defined by path.
"""
try:
+ if isinstance(content, str):
+ content = content.encode('utf-8')
tree = etree.fromstring(content)
responses = tree.findall("{DAV:}response")