From 1b9b9ed9059333fdbf84ba5e9d1ec72795c74fb6 Mon Sep 17 00:00:00 2001 From: David Stanek Date: Thu, 15 Jan 2015 18:29:47 +0000 Subject: [PATCH] Fixes bootstrap tests The existing test_bootstrap test didn't actually test anything. The called_anytime function would return a False, but nothing would turn that into an error. Change-Id: I32aab4dc80e6701abc70e34d8511c1008dadd2e0 --- keystoneclient/tests/v2_0/test_shell.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/keystoneclient/tests/v2_0/test_shell.py b/keystoneclient/tests/v2_0/test_shell.py index 57bbe9d01..4557accde 100644 --- a/keystoneclient/tests/v2_0/test_shell.py +++ b/keystoneclient/tests/v2_0/test_shell.py @@ -14,6 +14,7 @@ import os import sys import mock +from oslo.serialization import jsonutils import six from testtools import matchers @@ -381,22 +382,21 @@ class ShellTests(utils.TestCase): ' --tenant-name new-tenant') def called_anytime(method, path, json=None): + test_url = self.TEST_URL.strip('/') for r in self.requests.request_history: if not r.method == method: continue - if not r.url == self.TEST_URL + path: + if not r.url == test_url + path: continue if json: - last_request_body = r.body.decode('utf-8') - json_body = jsonutils.loads(last_request_body) - + json_body = jsonutils.loads(r.body) if not json_body == json: continue return True - return False + raise AssertionError('URL never called') called_anytime('POST', '/users', {'user': {'email': None, 'password': '1', @@ -409,7 +409,7 @@ class ShellTests(utils.TestCase): "description": None}}) called_anytime('POST', '/OS-KSADM/roles', - {"role": {"name": "new-role"}}) + {"role": {"name": "admin"}}) called_anytime('PUT', '/tenants/1/users/1/roles/OS-KSADM/1')