dsdb.tests.sites: merge interdependent tests
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Wed, 16 Sep 2015 23:35:55 +0000 (11:35 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 24 Dec 2015 03:09:29 +0000 (04:09 +0100)
The delete test deleted the site made by the create test, which worked
because "delete" sorts after "create" alphabetically.  By themselves,
"delete" would fail and "create" would neglect its duty to clean up.
This would be an issue if the order of tests changes, if one of the
tests is not run, or if another test appears in between. Everything is
fine if they give up the pretense of independence.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/dsdb/tests/python/sites.py

index 402d676ae1af29540ad408223f1317f1591a91e2..4fff77e5c27e364d8711046a1f1272c8b518c55f 100755 (executable)
@@ -81,8 +81,8 @@ class SitesBaseTests(samba.tests.TestCase):
 #tests on sites
 class SimpleSitesTests(SitesBaseTests):
 
-    def test_create(self):
-        """test creation of 1 site"""
+    def test_create_and_delete(self):
+        """test creation and deletion of 1 site"""
 
         self.ldb_admin.transaction_start()
         ok = sites.create_site(self.ldb_admin, self.ldb_admin.get_config_basedn(),
@@ -93,9 +93,6 @@ class SimpleSitesTests(SitesBaseTests):
                             sites.create_site, self.ldb_admin, self.ldb_admin.get_config_basedn(),
                             "testsamba")
 
-    def test_delete(self):
-        """test removal of 1 site"""
-
         self.ldb_admin.transaction_start()
         ok = sites.delete_site(self.ldb_admin, self.ldb_admin.get_config_basedn(),
                             "testsamba")