diff options
| author | Pádraig Brady <pbrady@redhat.com> | 2012-02-15 11:45:36 +0000 |
|---|---|---|
| committer | Pádraig Brady <pbrady@redhat.com> | 2012-02-15 11:46:46 +0000 |
| commit | dff1ac1dc5c266fd2471f48ad891a666f7ec7758 (patch) | |
| tree | 45f3f46cad003e9d022c76350ad04388778f525e | |
| parent | 99c2e02b44a1012c8e26fc7658dc40ec4620a1ee (diff) | |
tests: fix LdapDNS to allow running test_network in isolation
* nova/tests/test_network.py (LdapDNSTestCase): Since the
ldapdns module imports ldap unconditionally, the following
will not run on a system without python-ldap installed
./run_tests.sh test_network
Therefore ensure the fake ldap module is used, as is the
case when running the full test suite.
Change-Id: If92c613bf2684c25cdadf2ac7f53f2005979b2b6
| -rw-r--r-- | nova/tests/test_network.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/nova/tests/test_network.py b/nova/tests/test_network.py index 9e313ae5c..24ea02d23 100644 --- a/nova/tests/test_network.py +++ b/nova/tests/test_network.py @@ -16,6 +16,7 @@ # License for the specific language governing permissions and limitations # under the License. import mox +import sys from nova import context from nova import db @@ -1511,6 +1512,11 @@ 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 + temp = utils.import_object('nova.network.ldapdns.FakeLdapDNS') self.driver = temp self.driver.create_domain(domain1) @@ -1520,6 +1526,7 @@ class LdapDNSTestCase(test.TestCase): super(LdapDNSTestCase, self).tearDown() self.driver.delete_domain(domain1) self.driver.delete_domain(domain2) + sys.modules['ldap'] = self.saved_ldap def test_ldap_dns_domains(self): domains = self.driver.get_domains() |
