← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/maas/use-maasserver-testcase into lp:maas

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/use-maasserver-testcase into lp:maas.

Requested reviews:
  MAAS Maintainers (maas-maintainers)

For more details, see:
https://code.launchpad.net/~jtv/maas/use-maasserver-testcase/+merge/122002

Raphael has spotted the test that was using the wrong TestCase class, which led to the database not being reset between tests, which hid configuration problems in test_dns.py.  In this branch I make that other test (test_dhcp.py) use the right test case, and fix up the config problems in test_dns.py.

We'll also need to fix the TestCase situation: names should differ, for one.  And ideally tests that don't reset the database shouldn't even be allowed to modify it.


Jeroen
-- 
https://code.launchpad.net/~jtv/maas/use-maasserver-testcase/+merge/122002
Your team MAAS Maintainers is requested to review the proposed merge of lp:~jtv/maas/use-maasserver-testcase into lp:maas.
=== modified file 'src/maasserver/tests/test_dhcp.py'
--- src/maasserver/tests/test_dhcp.py	2012-08-21 10:33:21 +0000
+++ src/maasserver/tests/test_dhcp.py	2012-08-30 07:58:21 +0000
@@ -14,7 +14,7 @@
 
 from maasserver.dhcp import is_dhcp_management_enabled
 from maasserver.models import Config
-from maastesting.testcase import TestCase
+from maasserver.testing.testcase import TestCase
 
 
 class TestDHCPManagement(TestCase):

=== modified file 'src/maasserver/tests/test_dns.py'
--- src/maasserver/tests/test_dns.py	2012-08-10 13:10:53 +0000
+++ src/maasserver/tests/test_dns.py	2012-08-30 07:58:21 +0000
@@ -93,6 +93,7 @@
         self.assertRaises(dns.DNSException, dns.get_dns_server_address)
 
     def test_get_zone_creates_DNSZoneConfig(self):
+        Config.objects.set_config('manage_dhcp', True)
         nodegroup = factory.make_node_group()
         serial = random.randint(1, 100)
         zone = dns.get_zone(nodegroup, serial)
@@ -123,6 +124,7 @@
 
     def setUp(self):
         super(TestDNSConfigModifications, self).setUp()
+        Config.objects.set_config('manage_dhcp', True)
         self.bind = self.useFixture(BINDServer())
         self.patch(conf, 'DNS_CONFIG_DIR', self.bind.config.homedir)