From 74100c8657a7eb521360b95e9497c3b7cbd0a399 Mon Sep 17 00:00:00 2001 From: Steven Hardy Date: Thu, 7 Feb 2013 15:33:17 +0000 Subject: [PATCH] heat tests : split user test into User/AccessKey The test is testing two classes, User and AccessKey, so make the tests separate Change-Id: I79e183381ce69e2d2d564c254b2f903b60672e33 Signed-off-by: Steven Hardy --- heat/tests/test_user.py | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/heat/tests/test_user.py b/heat/tests/test_user.py index 2143e9ad..d65e4320 100644 --- a/heat/tests/test_user.py +++ b/heat/tests/test_user.py @@ -29,7 +29,7 @@ from heat.tests import fakes from heat.openstack.common import cfg -@attr(tag=['unit', 'resource', 'Unit']) +@attr(tag=['unit', 'resource', 'User']) @attr(speed='fast') class UserTest(unittest.TestCase): def setUp(self): @@ -111,6 +111,44 @@ class UserTest(unittest.TestCase): self.assertEqual('DELETE_COMPLETE', resource.state) self.m.VerifyAll() + +@attr(tag=['unit', 'resource', 'AccessKey']) +@attr(speed='fast') +class AccessKeyTest(unittest.TestCase): + def setUp(self): + self.m = mox.Mox() + self.fc = fakes.FakeKeystoneClient(username='test_stack.CfnUser') + cfg.CONF.set_default('heat_stack_user_role', 'stack_user_role') + + def tearDown(self): + self.m.UnsetStubs() + print "AccessKey teardown complete" + + def load_template(self): + self.path = os.path.dirname(os.path.realpath(__file__)).\ + replace('heat/tests', 'templates') + f = open("%s/Rails_Single_Instance.template" % self.path) + t = template_format.parse(f.read()) + f.close() + return t + + def parse_stack(self, t): + ctx = context.RequestContext.from_dict({ + 'tenant_id': 'test_tenant', + 'username': 'test_username', + 'password': 'password', + 'auth_url': 'http://localhost:5000/v2.0'}) + template = parser.Template(t) + params = parser.Parameters('test_stack', + template, + {'KeyName': 'test', + 'DBRootPassword': 'test', + 'DBUsername': 'test', + 'DBPassword': 'test'}) + stack = parser.Stack(ctx, 'test_stack', template, params) + + return stack + def create_access_key(self, t, stack, resource_name): resource = user.AccessKey(resource_name, t['Resources'][resource_name], -- 2.45.2