diff options
author | Thomas Duval <thomas.duval@orange.com> | 2016-09-07 14:09:19 +0200 |
---|---|---|
committer | Thomas Duval <thomas.duval@orange.com> | 2016-09-07 14:09:19 +0200 |
commit | 705b9d51a9d81ca75b07f71c09d9a4e9f35ed49a (patch) | |
tree | 60977353946129e3383f19e2d1ca288fd8e66f51 | |
parent | 64ee6a784251c6d977794125f176aed3c5e104ce (diff) |
Update subprocess code to be compliant with Python2 and update credentials for Swift Moonclient test.
Change-Id: I571f3c48765da02ed7ad6c23b006afe0f97a8636
-rw-r--r-- | moonclient/moonclient/shell.py | 7 | ||||
-rw-r--r-- | moonclient/moonclient/tests.py | 2 | ||||
-rw-r--r-- | moonclient/moonclient/tests/tests_empty_policy_swift.json | 3 | ||||
-rwxr-xr-x | tests/run_tests.py | 16 |
4 files changed, 16 insertions, 12 deletions
diff --git a/moonclient/moonclient/shell.py b/moonclient/moonclient/shell.py index d1d02518..8be73621 100644 --- a/moonclient/moonclient/shell.py +++ b/moonclient/moonclient/shell.py @@ -135,9 +135,12 @@ class MoonClient(App): def nb_error(self): return self._nb_error - def incr_error(self): + def incr_error(self, msg=""): self._nb_error += 1 - print("INCREMENTING ERRORS {}".format(self._nb_error)) + if not msg: + print("INCREMENTING ERRORS {}".format(self._nb_error)) + else: + print("INCREMENTING ERRORS {} [{}]".format(self._nb_error, msg)) def get_tenant_uuid(self, tenant_name): return self.get_url("/v3/projects?name={}".format(tenant_name), authtoken=True, port=5000)["projects"][0]["id"] diff --git a/moonclient/moonclient/tests.py b/moonclient/moonclient/tests.py index 3ef2aa90..b2c02f11 100644 --- a/moonclient/moonclient/tests.py +++ b/moonclient/moonclient/tests.py @@ -220,7 +220,7 @@ class TestsLaunch(Lister): overall_result = overall_result and True else: compare = "\033[1m\033[31mFalse\033[m" - self.app.incr_error() + self.app.incr_error(error_str) overall_result = overall_result and False else: overall_result = overall_result and compare diff --git a/moonclient/moonclient/tests/tests_empty_policy_swift.json b/moonclient/moonclient/tests/tests_empty_policy_swift.json index 6d8de2e4..e935da98 100644 --- a/moonclient/moonclient/tests/tests_empty_policy_swift.json +++ b/moonclient/moonclient/tests/tests_empty_policy_swift.json @@ -4,7 +4,8 @@ "authz": [ { "auth_name": "admin", - "auth_tenant": "demo", + "auth_password": "console", + "auth_tenant": "admin", "description": "Change user to admin (just in case...)" }, diff --git a/tests/run_tests.py b/tests/run_tests.py index 7c48e268..012e173d 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -49,14 +49,14 @@ except ImportError: def __get_endpoint_url(name="keystone"): - with subprocess.Popen(["openstack", "endpoint", "show", name, "-f", "yaml"], stdout=subprocess.PIPE) as proc: - y = yaml.load(proc.stdout.read()) - url = y['publicurl'] - url = url.replace("http://", "") - url = url.replace("https://", "") - host, port = url.split(":", maxsplit=1) - port = port.split("/")[0] - return host, port + proc = subprocess.Popen(["openstack", "endpoint", "show", name, "-f", "yaml"], stdout=subprocess.PIPE) + y = yaml.load(proc.stdout.read()) + url = y['publicurl'] + url = url.replace("http://", "") + url = url.replace("https://", "") + host, port = url.split(":") + port = port.split("/")[0] + return host, port def test_federation(): |