summaryrefslogtreecommitdiff
path: root/troveclient/tests/utils.py
diff options
context:
space:
mode:
authorPeter Stachowski <peter@tesora.com>2016-03-08 00:22:06 -0500
committerPeter Stachowski <peter@tesora.com>2016-03-11 18:10:50 -0500
commit457360c69f651aea92769c9e543492d770b84595 (patch)
treec9fb106454232e8372102b066d9b4a954d4c1c78 /troveclient/tests/utils.py
parent3c71e52b408bbd6c33fca85188db2c8f156fb341 (diff)
downloadpython-troveclient-2.2.0.tar.gz
Client support for instance module feature2.2.0
This adds support in the python API and Trove CLI for instance module commands. These commands include: - module-apply - module-remove - module-query - module-retrieve - module-list-instance The parsing of --instance was modified to allow multiple modules to be specified. This was extended to 'nics' as well. Partially Implements: blueprint module-management Change-Id: If62f5e51d4628cc6a8b10303d5c3893b3bd5057e
Diffstat (limited to 'troveclient/tests/utils.py')
-rw-r--r--troveclient/tests/utils.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/troveclient/tests/utils.py b/troveclient/tests/utils.py
index c3e81ac..a912649 100644
--- a/troveclient/tests/utils.py
+++ b/troveclient/tests/utils.py
@@ -23,6 +23,22 @@ AUTH_URL = "http://localhost:5002/auth_url"
AUTH_URL_V1 = "http://localhost:5002/auth_url/v1.0"
AUTH_URL_V2 = "http://localhost:5002/auth_url/v2.0"
+URL_QUERY_SEPARATOR = '&'
+URL_SEPARATOR = '?'
+
+
+def order_url(url):
+ """Returns the url with the query strings ordered, if they exist and
+ there's more than one. Otherwise the url is returned unaltered.
+ """
+ if URL_QUERY_SEPARATOR in url:
+ parts = url.split(URL_SEPARATOR)
+ if len(parts) == 2:
+ queries = sorted(parts[1].split(URL_QUERY_SEPARATOR))
+ url = URL_SEPARATOR.join(
+ [parts[0], URL_QUERY_SEPARATOR.join(queries)])
+ return url
+
def _patch_mock_to_raise_for_invalid_assert_calls():
def raise_for_invalid_assert_calls(wrapped):