1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-06-19 03:42:52 +00:00
seahub/tests/common/utils.py

19 lines
389 B
Python
Raw Normal View History

2014-09-03 04:20:26 +00:00
import string
import random
from .common import BASE_URL
def randomword(length):
2014-09-03 04:20:26 +00:00
return ''.join(random.choice(string.lowercase) for i in range(length))
def urljoin(base, *args):
url = base
if url[-1] != '/':
url += '/'
for arg in args:
arg = arg.strip('/')
url += arg + '/'
return url
def apiurl(*parts):
return urljoin(BASE_URL, *parts)