1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-07-03 02:06:45 +00:00
seahub/tests/common/utils.py
2014-09-05 13:51:44 +08:00

19 lines
389 B
Python

import string
import random
from .common import BASE_URL
def randomword(length):
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)