Merge "Remove dependency on python-ldap for tests"
This commit is contained in:
@@ -17,13 +17,11 @@
|
||||
# under the License.
|
||||
import mox
|
||||
import shutil
|
||||
import sys
|
||||
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
|
||||
@@ -1829,26 +1827,20 @@ 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.stub_module('ldap', fake_ldap)
|
||||
dns_class = 'nova.network.ldapdns.LdapDNS'
|
||||
self.driver = importutils.import_object(dns_class)
|
||||
|
||||
self.driver = FakeLdapDNS()
|
||||
attrs = {'objectClass': ['domainrelatedobject', 'dnsdomain',
|
||||
'domain', 'dcobject', 'top'],
|
||||
'associateddomain': ['root'],
|
||||
'dc': ['root']}
|
||||
self.driver.lobj.add_s("ou=hosts,dc=example,dc=org", attrs.items())
|
||||
self.driver.create_domain(domain1)
|
||||
self.driver.create_domain(domain2)
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
distribute>=0.6.24
|
||||
|
||||
coverage
|
||||
python-ldap
|
||||
mox==0.5.3
|
||||
nose
|
||||
openstack.nose_plugin>=0.7
|
||||
|
||||
Reference in New Issue
Block a user