diff --git a/tests/test_client_it.py b/tests/test_client_it.py
index 9bf8ae6..c144456 100644
--- a/tests/test_client_it.py
+++ b/tests/test_client_it.py
@@ -19,7 +19,7 @@ class ClientTestCase(TestCase):
def setUp(self):
options = {
'webdav_hostname': 'https://webdav.yandex.ru',
- 'webdav_login': 'webdavclient.test',
+ 'webdav_login': 'webdavclient.test2',
'webdav_password': 'Qwerty123!'
}
self.client = Client(options)
@@ -210,6 +210,8 @@ class ClientTestCase(TestCase):
self.client.mkdir(remote_path=self.remote_path_dir)
if not self.client.check(remote_path=self.remote_path_file):
self.client.upload_file(remote_path=self.remote_path_file, local_path=self.local_path_file)
+ if not path.exists(self.local_path_dir):
+ os.mkdir(self.local_path_dir)
def _prepare_for_uploading(self):
if not self.client.check(remote_path=self.remote_path_dir):
diff --git a/tests/test_client_unit.py b/tests/test_client_unit.py
index 40a1fe4..bbdb3c8 100644
--- a/tests/test_client_unit.py
+++ b/tests/test_client_unit.py
@@ -1,3 +1,4 @@
+# coding=utf-8
import unittest
from unittest import TestCase
@@ -127,6 +128,71 @@ class ClientTestCase(TestCase):
result = utils.etree_to_string(tree)
self.assertEquals(result, '\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' \
+ ''
+ path = '/test_dir'
+ hostname = 'https://webdav.yandex.ru'
+ result = utils.parse_is_dir_response(content, path, hostname)
+ self.assertTrue(result, 'It should be directory')
+
+ def test_parse_is_dir_response_directory(self):
+ content = '/test_' \
+ 'dir/HTTP/1.1 200 OK2018-05-10T07' \
+ ':40:11Ztest_dirThu, 10 May 2018' \
+ ' 07:40:11 GMT<' \
+ 'd:href>/test_dir/test.txtHTTP/1.1 200 OKab0b4b7973803c03639b848682b5f38c2018-05-10T07:40:12Ztest.txtThu, 10 May 2018 07:40:12 GMTtext/plain41'
+ path = '/test_dir/test.txt'
+ hostname = 'https://webdav.yandex.ru'
+ result = utils.parse_is_dir_response(content, path, hostname)
+ self.assertFalse(result, 'It should be file')
+
if __name__ == '__main__':
unittest.main()