diff options
Diffstat (limited to 'heat/tests')
-rw-r--r-- | heat/tests/clients/test_heat_client.py | 1 | ||||
-rw-r--r-- | heat/tests/db/test_sqlalchemy_api.py | 1 | ||||
-rw-r--r-- | heat/tests/test_auth_password.py | 73 | ||||
-rw-r--r-- | heat/tests/test_common_context.py | 4 | ||||
-rw-r--r-- | heat/tests/utils.py | 2 |
5 files changed, 30 insertions, 51 deletions
diff --git a/heat/tests/clients/test_heat_client.py b/heat/tests/clients/test_heat_client.py index e17427ceb..1c520c61b 100644 --- a/heat/tests/clients/test_heat_client.py +++ b/heat/tests/clients/test_heat_client.py @@ -471,6 +471,7 @@ class KeystoneClientTest(common.HeatTestCase): ctx = utils.dummy_context() ctx.auth_token = None + ctx.password = 'password' ctx.trust_id = None ctx.user_domain = 'adomain123' heat_ks_client = heat_keystoneclient.KeystoneClient(ctx) diff --git a/heat/tests/db/test_sqlalchemy_api.py b/heat/tests/db/test_sqlalchemy_api.py index 6e3b3acaf..b480e5d1b 100644 --- a/heat/tests/db/test_sqlalchemy_api.py +++ b/heat/tests/db/test_sqlalchemy_api.py @@ -933,6 +933,7 @@ class SqlAlchemyTest(common.HeatTestCase): self.m.VerifyAll() def test_user_creds_password(self): + self.ctx.password = 'password' self.ctx.trust_id = None self.ctx.region_name = 'RegionOne' db_creds = db_api.user_creds_create(self.ctx) diff --git a/heat/tests/test_auth_password.py b/heat/tests/test_auth_password.py index 000b1066a..0768c36be 100644 --- a/heat/tests/test_auth_password.py +++ b/heat/tests/test_auth_password.py @@ -40,53 +40,34 @@ EXPECTED_ENV_RESPONSE = { 'HTTP_X_AUTH_TOKEN': 'lalalalalala', } +TOKEN_V3_RESPONSE = { + 'version': 'v3', + 'project_id': 'tenant_id1', + 'project_name': 'tenant_name1', + 'user_id': 'user_id1', + 'username': 'user_name1', + 'service_catalog': None, + 'role_names': ['role1', 'role2'], + 'auth_token': 'lalalalalala', + 'user_domain_id': 'domain1' +} TOKEN_V2_RESPONSE = { - 'token': { - 'id': 'lalalalalala', - 'expires': '2020-01-01T00:00:10.000123Z', - 'tenant': { - 'id': 'tenant_id1', - 'name': 'tenant_name1', - }, - }, - 'user': { - 'id': 'user_id1', - 'name': 'user_name1', - 'roles': [ - {'name': 'role1'}, - {'name': 'role2'}, - ], - }, - 'serviceCatalog': {} + 'version': 'v2', + 'tenant_id': 'tenant_id1', + 'tenant_name': 'tenant_name1', + 'user_id': 'user_id1', + 'service_catalog': None, + 'username': 'user_name1', + 'role_names': ['role1', 'role2'], + 'auth_token': 'lalalalalala', + 'user_domain_id': 'domain1' } -TOKEN_V3_RESPONSE = { - 'version': 'v3', - 'project': { - 'id': 'tenant_id1', - 'name': 'tenant_name1', - }, - 'token': { - 'id': 'lalalalalala', - 'expires': '2020-01-01T00:00:10.000123Z', - 'tenant': { - 'id': 'tenant_id1', - 'name': 'tenant_name1', - }, - 'methods': ['password'], - }, - 'user': { - 'id': 'user_id1', - 'name': 'user_name1', - }, - 'roles': [ - {'name': 'role1'}, - {'name': 'role2'}, - ], - 'auth_token': 'lalalalalala' -} +class FakeAccessInfo(object): + def __init__(self, **args): + self.__dict__.update(args) class FakeApp(object): @@ -131,9 +112,8 @@ class KeystonePasswordAuthProtocolTest(common.HeatTestCase): username='user_name1').AndReturn(mock_auth) m = mock_auth.get_access(mox.IsA(ks_session.Session)) - m.AndReturn(TOKEN_V2_RESPONSE) + m.AndReturn(FakeAccessInfo(**TOKEN_V2_RESPONSE)) - self.app.expected_env['keystone.token_info'] = TOKEN_V2_RESPONSE self.m.ReplayAll() req = webob.Request.blank('/tenant_id1/') req.headers['X_AUTH_USER'] = 'user_name1' @@ -154,11 +134,8 @@ class KeystonePasswordAuthProtocolTest(common.HeatTestCase): username='user_name1').AndReturn(mock_auth) m = mock_auth.get_access(mox.IsA(ks_session.Session)) - m.AndReturn(TOKEN_V3_RESPONSE) + m.AndReturn(FakeAccessInfo(**TOKEN_V3_RESPONSE)) - self.app.expected_env['keystone.token_info'] = { - 'token': TOKEN_V3_RESPONSE - } self.m.ReplayAll() req = webob.Request.blank('/tenant_id1/') req.headers['X_AUTH_USER'] = 'user_name1' diff --git a/heat/tests/test_common_context.py b/heat/tests/test_common_context.py index 9145fd3f4..9f66d9e0d 100644 --- a/heat/tests/test_common_context.py +++ b/heat/tests/test_common_context.py @@ -50,8 +50,8 @@ class TestRequestContext(common.HeatTestCase): 'aws_creds': 'blah', 'region_name': 'RegionOne', 'user_identity': 'fooUser 456tenant', - 'user_domain_id': None, - 'project_domain_id': None} + 'user_domain': None, + 'project_domain': None} super(TestRequestContext, self).setUp() diff --git a/heat/tests/utils.py b/heat/tests/utils.py index 511a31466..85d802070 100644 --- a/heat/tests/utils.py +++ b/heat/tests/utils.py @@ -72,7 +72,7 @@ def reset_dummy_db(): def dummy_context(user='test_username', tenant_id='test_tenant_id', - password='password', roles=None, user_id=None, + password='', roles=None, user_id=None, trust_id=None, region_name=None, is_admin=False): roles = roles or [] return context.RequestContext.from_dict({ |