summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYaguang Tang <heut2008@gmail.com>2012-09-23 12:33:18 +0800
committerYaguang Tang <heut2008@gmail.com>2012-09-23 16:47:26 +0800
commit821271113df9cfc2be6b24cd5574fbe08b4cd815 (patch)
treecafaef6899deac0519c4085d87f36ef7eb589573
parent338fae4f2be127f65491860fc46dc7436a5610be (diff)
downloadnova-821271113df9cfc2be6b24cd5574fbe08b4cd815.tar.gz
nova-821271113df9cfc2be6b24cd5574fbe08b4cd815.tar.xz
nova-821271113df9cfc2be6b24cd5574fbe08b4cd815.zip
Move fakeldap.py from auth dir to tests.
Also removes the auth dir from nova. fix bug lp:1054848 Change-Id: I9c2710c9789ff8413bc80044eba94f3a851d8544
-rw-r--r--nova/auth/__init__.py28
-rw-r--r--nova/network/ldapdns.py12
-rw-r--r--nova/tests/fake_ldap.py (renamed from nova/auth/fakeldap.py)0
-rw-r--r--nova/tests/network/test_manager.py20
-rw-r--r--tools/test-requires1
5 files changed, 17 insertions, 44 deletions
diff --git a/nova/auth/__init__.py b/nova/auth/__init__.py
deleted file mode 100644
index e81c739da..000000000
--- a/nova/auth/__init__.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
-# Copyright 2010 United States Government as represented by the
-# Administrator of the National Aeronautics and Space Administration.
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-"""
-:mod:`nova.auth` -- Authentication and Access Control
-=====================================================
-
-.. automodule:: nova.auth
- :platform: Unix
- :synopsis: User-and-Project based RBAC using LDAP, SAML.
-.. moduleauthor:: Jesse Andrews <jesse@ansolabs.com>
-.. moduleauthor:: Vishvananda Ishaya <vishvananda@gmail.com>
-.. moduleauthor:: Joshua McKenty <joshua@cognition.ca>
-"""
diff --git a/nova/network/ldapdns.py b/nova/network/ldapdns.py
index 374e5df85..1fda0e11a 100644
--- a/nova/network/ldapdns.py
+++ b/nova/network/ldapdns.py
@@ -15,7 +15,6 @@
import ldap
import time
-from nova.auth import fakeldap
from nova import exception
from nova import flags
from nova.openstack.common import cfg
@@ -360,14 +359,3 @@ class LdapDNS(object):
def delete_dns_file(self):
LOG.warn("This shouldn't be getting called except during testing.")
pass
-
-
-class FakeLdapDNS(LdapDNS):
- """For testing purposes, a DNS driver backed with a fake ldap driver."""
- def __init__(self):
- self.lobj = fakeldap.FakeLDAP()
- attrs = {'objectClass': ['domainrelatedobject', 'dnsdomain',
- 'domain', 'dcobject', 'top'],
- 'associateddomain': ['root'],
- 'dc': ['root']}
- self.lobj.add_s(flags.FLAGS.ldap_dns_base_dn, create_modlist(attrs))
diff --git a/nova/auth/fakeldap.py b/nova/tests/fake_ldap.py
index b3fab03ab..b3fab03ab 100644
--- a/nova/auth/fakeldap.py
+++ b/nova/tests/fake_ldap.py
diff --git a/nova/tests/network/test_manager.py b/nova/tests/network/test_manager.py
index 8ef37fe95..2f597547c 100644
--- a/nova/tests/network/test_manager.py
+++ b/nova/tests/network/test_manager.py
@@ -23,6 +23,7 @@ import tempfile
from nova import context
from nova import db
from nova import exception
+from nova.network import ldapdns
from nova.network import linux_net
from nova.network import manager as network_manager
from nova.openstack.common import importutils
@@ -30,6 +31,7 @@ from nova.openstack.common import log as logging
from nova.openstack.common import rpc
import nova.policy
from nova import test
+from nova.tests import fake_ldap
from nova.tests import fake_network
from nova import utils
@@ -1827,17 +1829,27 @@ domain1 = "example.org"
domain2 = "example.com"
+class FakeLdapDNS(ldapdns.LdapDNS):
+ """For testing purposes, a DNS driver backed with a fake ldap driver."""
+ def __init__(self):
+ self.lobj = fake_ldap.FakeLDAP()
+ attrs = {'objectClass': ['domainrelatedobject', 'dnsdomain',
+ 'domain', 'dcobject', 'top'],
+ 'associateddomain': ['root'],
+ 'dc': ['root']}
+ self.lobj.add_s("ou=hosts,dc=example,dc=org",
+ ldapdns.create_modlist(attrs))
+
+
class LdapDNSTestCase(test.TestCase):
"""Tests nova.network.ldapdns.LdapDNS"""
def setUp(self):
super(LdapDNSTestCase, self).setUp()
self.saved_ldap = sys.modules.get('ldap')
- import nova.auth.fakeldap
- sys.modules['ldap'] = nova.auth.fakeldap
+ sys.modules['ldap'] = fake_ldap
- temp = importutils.import_object('nova.network.ldapdns.FakeLdapDNS')
- self.driver = temp
+ self.driver = FakeLdapDNS()
self.driver.create_domain(domain1)
self.driver.create_domain(domain2)
diff --git a/tools/test-requires b/tools/test-requires
index 106c258de..5592cada8 100644
--- a/tools/test-requires
+++ b/tools/test-requires
@@ -2,6 +2,7 @@
distribute>=0.6.24
coverage
+python-ldap
mox==0.5.3
nose
openstack.nose_plugin>=0.7