summaryrefslogtreecommitdiffstats
path: root/testsuite/Testsrc/Testlib
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-10-29 09:35:39 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-10-29 09:35:39 -0400
commitef87028da290f8c196075f4e8154596329d56f15 (patch)
tree1ce3f883c1e26e4cfb2fa289a681167eb7db5579 /testsuite/Testsrc/Testlib
parent44756f91921d03a012fef6ac321ae78e67c7585a (diff)
downloadbcfg2-ef87028da290f8c196075f4e8154596329d56f15.tar.gz
bcfg2-ef87028da290f8c196075f4e8154596329d56f15.tar.bz2
bcfg2-ef87028da290f8c196075f4e8154596329d56f15.zip
fixed unit tests
Diffstat (limited to 'testsuite/Testsrc/Testlib')
-rw-r--r--testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testbase.py2
-rw-r--r--testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py17
2 files changed, 10 insertions, 9 deletions
diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testbase.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testbase.py
index 7ee3697bb..f2cd39142 100644
--- a/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testbase.py
+++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testbase.py
@@ -49,7 +49,7 @@ class TestDebuggable(Bcfg2TestCase):
d.debug_flag = False
d.debug_log("test")
self.assertFalse(d.logger.error.called)
-
+
d.logger.reset_mock()
d.debug_log("test", flag=True)
self.assertTrue(d.logger.error.called)
diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py
index 21502d1d8..b3d428642 100644
--- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py
+++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py
@@ -102,7 +102,8 @@ class TestMetadataDB(DBModelTestCase):
if HAS_DJANGO or can_skip:
- class TestClientVersions(Bcfg2TestCase):
+ class TestClientVersions(TestDatabaseBacked):
+ test_obj = ClientVersions
test_clients = dict(client1="1.2.0",
client2="1.2.2",
client3="1.3.0pre1",
@@ -117,17 +118,17 @@ if HAS_DJANGO or can_skip:
MetadataClientModel(hostname=client, version=version).save()
def test__contains(self):
- v = ClientVersions()
+ v = self.get_obj()
self.assertIn("client1", v)
self.assertIn("client5", v)
self.assertNotIn("client__contains", v)
def test_keys(self):
- v = ClientVersions()
+ v = self.get_obj()
self.assertItemsEqual(self.test_clients.keys(), v.keys())
def test__setitem(self):
- v = ClientVersions()
+ v = self.get_obj()
# test setting version of existing client
v["client1"] = "1.2.3"
@@ -153,7 +154,7 @@ if HAS_DJANGO or can_skip:
self.assertEqual(client.version, None)
def test__getitem(self):
- v = ClientVersions()
+ v = self.get_obj()
# test getting existing client
self.assertEqual(v['client2'], "1.2.2")
@@ -175,15 +176,15 @@ if HAS_DJANGO or can_skip:
"%s not raised" % expected.__class__.__name__)
def test__len(self):
- v = ClientVersions()
+ v = self.get_obj()
self.assertEqual(len(v), MetadataClientModel.objects.count())
def test__iter(self):
- v = ClientVersions()
+ v = self.get_obj()
self.assertItemsEqual([h for h in iter(v)], v.keys())
def test__delitem(self):
- v = ClientVersions()
+ v = self.get_obj()
# test adding new client
new = "client__delitem"