-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_webdav_token.py
64 lines (53 loc) · 1.88 KB
/
test_webdav_token.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
""" Testing WebDAV functions for Sunet Drive
Author: Richard Freitag <[email protected]>
"""
import unittest
import requests
from requests.auth import HTTPBasicAuth
import json
import os
from webdav3.client import Client
import logging
import threading
import time
from datetime import datetime
import sunetdrive
g_maxCheck = 10
g_testFolder = 'SeleniumCollaboraTest'
g_stressTestFolder = 'SeleniumCollaboraStressTest'
g_sharedTestFolder = 'SharedFolder'
g_personalBucket = 'selenium-personal'
g_systemBucket = 'selenium-system'
g_filename=datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
ocsheaders = { "OCS-APIRequest" : "true" }
logger = logging.getLogger(__name__)
logging.basicConfig(format = '%(asctime)s - %(module)s.%(funcName)s - %(levelname)s: %(message)s',
datefmt = '%Y-%m-%d %H:%M:%S', level = logging.INFO)
class TestWebDAV(unittest.TestCase):
def test_logger(self):
global logger
logger.info(f'logger.info test_logger')
pass
def test_webdav_list(self):
global logger
logger.info(f'test_webdav_list')
drv = sunetdrive.TestTarget()
logger.info(f'WebDAVList')
drv = sunetdrive.TestTarget()
nodeuser = '[email protected]'
nodepwd = 'xYtG32ydX9ybt6ub3zdoCmdygjW5UBk7AQXsawU0eVfNwN8KLoy8mfIIBMci9tT6Wg8dWThn'
logger.info(f'Usernames: {nodeuser}')
logger.warning(f'Testing user: {nodeuser}')
url = drv.get_webdav_url('su', nodeuser)
logger.info(f'URL: {url}')
options = {
'webdav_hostname': url,
'webdav_login' : nodeuser,
'webdav_password' : nodepwd
}
client = Client(options)
logger.info(client.list())
if __name__ == '__main__':
import xmlrunner
# unittest.main()
unittest.main(testRunner=xmlrunner.XMLTestRunner(output='test-reports'))