diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-03-01 22:28:05 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-03-01 22:28:05 +0000 |
| commit | 07ca6f64de76b5955c233b830122877dc07df142 (patch) | |
| tree | 0c943d16ae32244373086356b9cdc3adb05cab4b /nova/tests | |
| parent | 34d50ed65fc6f68fa5efb524ab4d82eea8e499f0 (diff) | |
| parent | f1bf4661ff1e1938a5bc1ef55ccec99cae4f2af7 (diff) | |
Merge "Minor cleanup based on HACKING"
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/api/openstack/compute/contrib/test_users.py | 11 | ||||
| -rw-r--r-- | nova/tests/api/openstack/fakes.py | 17 | ||||
| -rw-r--r-- | nova/tests/scheduler/test_distributed_scheduler.py | 3 | ||||
| -rw-r--r-- | nova/tests/test_misc.py | 5 | ||||
| -rw-r--r-- | nova/tests/test_utils.py | 3 |
5 files changed, 22 insertions, 17 deletions
diff --git a/nova/tests/api/openstack/compute/contrib/test_users.py b/nova/tests/api/openstack/compute/contrib/test_users.py index 3dd0b3074..c67cdf692 100644 --- a/nova/tests/api/openstack/compute/contrib/test_users.py +++ b/nova/tests/api/openstack/compute/contrib/test_users.py @@ -16,7 +16,7 @@ from lxml import etree from nova.api.openstack.compute.contrib import users -from nova.auth.manager import User, Project +import nova.auth.manager as auth_manager from nova import test from nova.tests.api.openstack import fakes from nova import utils @@ -33,7 +33,8 @@ class UsersTest(test.TestCase): self.stubs.Set(users.Controller, '__init__', fake_init) fakes.FakeAuthManager.clear_fakes() - fakes.FakeAuthManager.projects = dict(testacct=Project('testacct', + fakes.FakeAuthManager.projects = dict(testacct=auth_manager.Project( + 'testacct', 'testacct', 'id1', 'test', @@ -44,8 +45,10 @@ class UsersTest(test.TestCase): fakes.stub_out_auth(self.stubs) fakemgr = fakes.FakeAuthManager() - fakemgr.add_user(User('id1', 'guy1', 'acc1', 'secret1', False)) - fakemgr.add_user(User('id2', 'guy2', 'acc2', 'secret2', True)) + fakemgr.add_user(auth_manager.User('id1', 'guy1', + 'acc1', 'secret1', False)) + fakemgr.add_user(auth_manager.User('id2', 'guy2', + 'acc2', 'secret2', True)) self.controller = users.Controller() diff --git a/nova/tests/api/openstack/fakes.py b/nova/tests/api/openstack/fakes.py index fe48dd88d..78d0d6da4 100644 --- a/nova/tests/api/openstack/fakes.py +++ b/nova/tests/api/openstack/fakes.py @@ -32,7 +32,7 @@ from nova.api.openstack.compute import limits from nova.api.openstack import urlmap from nova.api.openstack.compute import versions from nova.api.openstack import wsgi as os_wsgi -from nova.auth.manager import User, Project +import nova.auth.manager as auth_manager from nova.compute import instance_types from nova.compute import vm_states from nova import context @@ -349,9 +349,9 @@ class FakeAuthManager(object): @classmethod def reset_fake_data(cls): - u1 = User('id1', 'guy1', 'acc1', 'secret1', False) + u1 = auth_manager.User('id1', 'guy1', 'acc1', 'secret1', False) cls.auth_data = [u1] - cls.projects = dict(testacct=Project('testacct', + cls.projects = dict(testacct=auth_manager.Project('testacct', 'testacct', 'id1', 'test', @@ -382,7 +382,7 @@ class FakeAuthManager(object): return None def create_user(self, name, access=None, secret=None, admin=False): - u = User(name, name, access, secret, admin) + u = auth_manager.User(name, name, access, secret, admin) FakeAuthManager.auth_data.append(u) return u @@ -399,7 +399,7 @@ class FakeAuthManager(object): return user.admin def is_project_member(self, user_id, project): - if not isinstance(project, Project): + if not isinstance(project, auth_manager.Project): try: project = self.get_project(project) except exc.NotFound: @@ -409,9 +409,10 @@ class FakeAuthManager(object): def create_project(self, name, manager_user, description=None, member_users=None): - member_ids = ([User.safe_id(m) for m in member_users] + member_ids = ([auto_manager.User.safe_id(m) for m in member_users] if member_users else []) - p = Project(name, name, User.safe_id(manager_user), + p = auth_manager.Project(name, name, + auth_manager.User.safe_id(manager_user), description, member_ids) FakeAuthManager.projects[name] = p return p @@ -422,7 +423,7 @@ class FakeAuthManager(object): def modify_project(self, project, manager_user=None, description=None): p = FakeAuthManager.projects.get(project) - p.project_manager_id = User.safe_id(manager_user) + p.project_manager_id = auth_manager.User.safe_id(manager_user) p.description = description def get_project(self, pid): diff --git a/nova/tests/scheduler/test_distributed_scheduler.py b/nova/tests/scheduler/test_distributed_scheduler.py index a8e2d9317..950280442 100644 --- a/nova/tests/scheduler/test_distributed_scheduler.py +++ b/nova/tests/scheduler/test_distributed_scheduler.py @@ -24,7 +24,8 @@ from nova.scheduler import least_cost from nova.scheduler import host_manager from nova.scheduler import distributed_scheduler from nova import test -from nova.tests.scheduler import fakes, test_scheduler +from nova.tests.scheduler import fakes +from nova.tests.scheduler import test_scheduler def fake_filter_hosts(hosts, filter_properties): diff --git a/nova/tests/test_misc.py b/nova/tests/test_misc.py index 0a673e68e..ab352b547 100644 --- a/nova/tests/test_misc.py +++ b/nova/tests/test_misc.py @@ -26,7 +26,6 @@ from eventlet import greenthread from nova import exception from nova import test from nova import utils -from nova.utils import parse_mailmap, str_dict_replace class ExceptionTestCase(test.TestCase): @@ -46,7 +45,7 @@ class ProjectTestCase(test.TestCase): topdir = os.path.normpath(os.path.dirname(__file__) + '/../../') missing = set() contributors = set() - mailmap = parse_mailmap(os.path.join(topdir, '.mailmap')) + mailmap = utils.parse_mailmap(os.path.join(topdir, '.mailmap')) authors_file = open(os.path.join(topdir, 'Authors'), 'r').read().lower() @@ -57,7 +56,7 @@ class ProjectTestCase(test.TestCase): if "jenkins" in email and "openstack.org" in email: continue email = '<' + email.lower() + '>' - contributors.add(str_dict_replace(email, mailmap)) + contributors.add(utils.str_dict_replace(email, mailmap)) else: return diff --git a/nova/tests/test_utils.py b/nova/tests/test_utils.py index 5258efdc4..454d1fb7a 100644 --- a/nova/tests/test_utils.py +++ b/nova/tests/test_utils.py @@ -529,7 +529,8 @@ class MonkeyPatchTestCase(test.TestCase): def test_monkey_patch(self): utils.monkey_patch() nova.tests.monkey_patch_example.CALLED_FUNCTION = [] - from nova.tests.monkey_patch_example import example_a, example_b + from nova.tests.monkey_patch_example import example_a + from nova.tests.monkey_patch_example import example_b self.assertEqual('Example function', example_a.example_function_a()) exampleA = example_a.ExampleClassA() |
