fixes #2 – client method upload_file won't work

This commit is contained in:
evgeny.ezhov 2017-09-10 11:51:10 +03:00
parent ffe7d0178d
commit b749855a80
4 changed files with 51 additions and 25 deletions

1
tests/res/test.txt Normal file
View file

@ -0,0 +1 @@
test content for testing of webdav client

26
tests/test_client.py Normal file
View file

@ -0,0 +1,26 @@
from unittest import TestCase
from webdav2.client import Client
class ClientTestCase(TestCase):
def setUp(self):
options = {
'webdav_hostname': 'https://webdav.yandex.ru',
'webdav_login': 'webdavclient.test',
'webdav_password': 'Qwerty123!'
}
self.client = Client(options)
def test_list(self):
file_list = self.client.list()
self.assertIsNotNone(file_list, 'List of files should not be None')
self.assertGreater(file_list.__len__(), 0, 'Expected that amount of files more then 0')
def test_upload_file(self):
remote_path = 'test.txt'
local_path = './res/test.txt'
if self.client.check(remote_path=remote_path):
self.client.clean(remote_path=remote_path)
self.client.upload_file(remote_path=remote_path, local_path=local_path)
self.assertTrue(self.client.check(remote_path=remote_path))