fixes #2 – client method upload_file won't work
This commit is contained in:
parent
ffe7d0178d
commit
b749855a80
4 changed files with 51 additions and 25 deletions
1
tests/res/test.txt
Normal file
1
tests/res/test.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
test content for testing of webdav client
|
||||
26
tests/test_client.py
Normal file
26
tests/test_client.py
Normal 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))
|
||||
Loading…
Add table
Add a link
Reference in a new issue