summaryrefslogtreecommitdiffstats
path: root/testsuite/Testsrc/Testlib/TestServer/TestPlugins
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2013-10-29 10:21:12 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-10-29 15:22:33 -0400
commit6dd9756f7a87d5e875f5db02f306c7b906902a96 (patch)
tree81ab5e948e9b2449609e260628d5d14f63f5a6cf /testsuite/Testsrc/Testlib/TestServer/TestPlugins
parentaec12296330b121fcb3fd038f85c0a4590be8ce4 (diff)
downloadbcfg2-6dd9756f7a87d5e875f5db02f306c7b906902a96.tar.gz
bcfg2-6dd9756f7a87d5e875f5db02f306c7b906902a96.tar.bz2
bcfg2-6dd9756f7a87d5e875f5db02f306c7b906902a96.zip
Plugins: refactored out unnecessary datastore constructor argument
Diffstat (limited to 'testsuite/Testsrc/Testlib/TestServer/TestPlugins')
-rw-r--r--testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py3
-rw-r--r--testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py26
2 files changed, 16 insertions, 13 deletions
diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py
index 8814ae171..d3fa15236 100644
--- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py
+++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py
@@ -100,8 +100,9 @@ def get_metadata_object(core=None):
@patchIf(not isinstance(os.makedirs, Mock), "os.makedirs", Mock())
@patchIf(not isinstance(lxml.etree.Element, Mock),
"lxml.etree.Element", Mock())
+
def inner():
- return Metadata(core, datastore)
+ return Metadata(core)
return inner()
diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py
index 4830f9f2f..68313e6fb 100644
--- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py
+++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py
@@ -19,7 +19,7 @@ while path != "/":
path = os.path.dirname(path)
from common import *
from Bcfg2.Server.Plugins.Probes import load_django_models
-from TestPlugin import TestEntrySet, TestProbing, TestConnector, \
+from TestPlugin import TestEntrySet, TestPlugin, \
TestDatabaseBacked
load_django_models()
@@ -200,7 +200,7 @@ group-specific"""
assert False, "Strange probe found in get_probe_data() return"
-class TestProbes(Bcfg2TestCase):
+class TestProbes(TestPlugin):
test_obj = Probes
test_xdata = lxml.etree.Element("test")
@@ -236,21 +236,23 @@ group: group:with:colons
if self.datastore is not None:
shutil.rmtree(self.datastore)
self.datastore = None
+ Bcfg2.Options.setup.repository = datastore
- def get_obj(self, core=None):
- if core is None:
- core = Mock()
- if Bcfg2.Options.setup.probes_db:
- @patch("os.makedirs", Mock())
- def inner():
- return self.test_obj(core, datastore)
- return inner()
- else:
+ def get_obj(self):
+ if not Bcfg2.Options.setup.probes_db:
# actually use a real datastore so we can read and write
# probed.xml
if self.datastore is None:
self.datastore = tempfile.mkdtemp()
- return self.test_obj(core, self.datastore)
+ Bcfg2.Options.setup.repository = self.datastore
+ datadir = os.path.join(self.datastore, self.test_obj.name)
+ if not os.path.exists(datadir):
+ os.makedirs(datadir)
+ return TestPlugin.get_obj(self)
+
+ def test__init(self):
+ if Bcfg2.Options.setup.probes_db:
+ TestPlugin.test__init(self)
def test_GetProbes(self):
p = self.get_obj()