diff options
author | SerenaFeng <feng.xiaowei@zte.com.cn> | 2017-05-17 18:31:26 +0800 |
---|---|---|
committer | Serena Feng <feng.xiaowei@zte.com.cn> | 2017-05-18 01:01:05 +0000 |
commit | d55972a735e6038fee4ce7ad6501983f87275498 (patch) | |
tree | c9cdccdd0fc75f9e45363d2f2bbe3e3997cf3f6a /utils/test/testapi/opnfv_testapi/ui/auth/utils.py | |
parent | 90f6563370e3c152f884fd1c811fca7457f07004 (diff) |
add signin web to TestAPI
Change-Id: I4d39a8561c8ebd3238a495e5799fd43fb1a508b9
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'utils/test/testapi/opnfv_testapi/ui/auth/utils.py')
-rw-r--r-- | utils/test/testapi/opnfv_testapi/ui/auth/utils.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/utils/test/testapi/opnfv_testapi/ui/auth/utils.py b/utils/test/testapi/opnfv_testapi/ui/auth/utils.py new file mode 100644 index 000000000..c3912ad0c --- /dev/null +++ b/utils/test/testapi/opnfv_testapi/ui/auth/utils.py @@ -0,0 +1,23 @@ +import random +import string + +from six.moves.urllib import parse + + +def get_token(length=30): + """Get random token.""" + return ''.join(random.choice(string.ascii_lowercase) + for i in range(length)) + + +def set_query_params(url, params): + """Set params in given query.""" + url_parts = parse.urlparse(url) + url = parse.urlunparse(( + url_parts.scheme, + url_parts.netloc, + url_parts.path, + url_parts.params, + parse.urlencode(params), + url_parts.fragment)) + return url |