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

Proposed by Jeroen T. Vermeulen on 2012-08-30
Status: Merged
Approved by: Jeroen T. Vermeulen on 2012-08-30
Approved revision: 947
Merged at revision: 948
Proposed branch: lp:~jtv/maas/use-maasserver-testcase
Merge into: lp:maas/trunk
Diff against target: 31 lines (+3/-1)
2 files modified
src/maasserver/tests/test_dhcp.py (+1/-1)
src/maasserver/tests/test_dns.py (+2/-0)
To merge this branch: bzr merge lp:~jtv/maas/use-maasserver-testcase
Reviewer Review Type Date Requested Status
Gavin Panella (community) 2012-08-30 Approve on 2012-08-30
Review via email: mp+122002@code.launchpad.net

Commit Message

Proper fix for the test_dns.py failures.

Description of the Change

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

To post a comment you must log in.
Gavin Panella (allenap) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/tests/test_dhcp.py'
2--- src/maasserver/tests/test_dhcp.py 2012-08-21 10:33:21 +0000
3+++ src/maasserver/tests/test_dhcp.py 2012-08-30 07:58:21 +0000
4@@ -14,7 +14,7 @@
5
6 from maasserver.dhcp import is_dhcp_management_enabled
7 from maasserver.models import Config
8-from maastesting.testcase import TestCase
9+from maasserver.testing.testcase import TestCase
10
11
12 class TestDHCPManagement(TestCase):
13
14=== modified file 'src/maasserver/tests/test_dns.py'
15--- src/maasserver/tests/test_dns.py 2012-08-10 13:10:53 +0000
16+++ src/maasserver/tests/test_dns.py 2012-08-30 07:58:21 +0000
17@@ -93,6 +93,7 @@
18 self.assertRaises(dns.DNSException, dns.get_dns_server_address)
19
20 def test_get_zone_creates_DNSZoneConfig(self):
21+ Config.objects.set_config('manage_dhcp', True)
22 nodegroup = factory.make_node_group()
23 serial = random.randint(1, 100)
24 zone = dns.get_zone(nodegroup, serial)
25@@ -123,6 +124,7 @@
26
27 def setUp(self):
28 super(TestDNSConfigModifications, self).setUp()
29+ Config.objects.set_config('manage_dhcp', True)
30 self.bind = self.useFixture(BINDServer())
31 self.patch(conf, 'DNS_CONFIG_DIR', self.bind.config.homedir)
32