Skip to content

Commit c0fd922

Browse files
committed
updated
1 parent 6ddaac2 commit c0fd922

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

webdavfs/tests/tests_common.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
from __future__ import unicode_literals
2+
3+
import uuid
4+
import furl
5+
import json
6+
import os
7+
import unittest
8+
9+
from webdavfs import webdavfs
10+
from fs.test import FSTestCases
11+
12+
from nose.plugins.attrib import attr
13+
14+
webdav_url = os.environ.get('FS_WEBDAV_URL', 'http://admin:[email protected]:20082/exist/webdav/db')
15+
16+
@attr('slow')
17+
class TestWebDAVFS(unittest.TestCase):
18+
"""Test WebDAVFS implementation."""
19+
20+
def __init__(self, *args, **kw):
21+
self.test_root = unicode(uuid.uuid4())
22+
super(TestWebDAVFS, self).__init__(*args, **kw)
23+
24+
def make_fs(self):
25+
26+
f = furl.furl(webdav_url)
27+
url = '{0}://{1}:{2}'.format(f.scheme, f.host, f.port)
28+
creds = {'login': f.username, 'password': f.password}
29+
root = str(f.path)
30+
handle = webdavfs.WebDAVFS(url, creds, root)
31+
if handle.exists(self.test_root):
32+
handle.rmdir(self.test_root, recursive=True)
33+
handle.makedir(self.test_root)
34+
handle = webdavfs.WebDAVFS(url, creds, root + '/' + self.test_root)
35+
return handle
36+
37+
def test_directories_mkdir_removedir(self):
38+
fs = self.make_fs()
39+
for i in range(10):
40+
fs.makedir(unicode(i))
41+
for i in range(10):
42+
fs.removedir(unicode(i))

0 commit comments

Comments
 (0)