From 808e34ee152a0ecb4c9c946fe1383986304cf59e Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Wed, 17 Jul 2013 11:09:02 +1200 Subject: [PATCH] Test utils dummy_context for tests that need one. Change-Id: I3c54ec76a4d2bfd03cf60b70c422bc6269af01c9 --- heat/tests/utils.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/heat/tests/utils.py b/heat/tests/utils.py index 2c622bee..72828c0b 100644 --- a/heat/tests/utils.py +++ b/heat/tests/utils.py @@ -94,13 +94,20 @@ def setup_dummy_db(): conn = engine.connect() +def dummy_context(user='test_username', tenant_id='test_tenant_id', + password='password', roles=[]): + return context.RequestContext.from_dict({ + 'tenant_id': tenant_id, + 'tenant': 'test_tenant', + 'username': user, + 'password': password, + 'roles': roles, + 'auth_url': 'http://localhost:5000/v2.0' + }) + + def parse_stack(t, params={}, stack_name='test_stack', stack_id=None): - ctx = context.RequestContext.from_dict({'tenant_id': 'test_tenant', - 'tenant': 'test_tenant', - 'username': 'test_username', - 'password': 'password', - 'auth_url': - 'http://localhost:5000/v2.0'}) + ctx = dummy_context() template = parser.Template(t) stack = parser.Stack(ctx, stack_name, template, environment.Environment(params), stack_id) -- 2.45.2