summaryrefslogtreecommitdiffstats
path: root/testsuite/Testlib/TestServer/TestPlugins/TestProbes.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-08-14 14:44:08 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-08-14 15:43:32 -0400
commitbe4f6ad065fa17ae34c810f2c09bc9f5fa4d9c23 (patch)
tree0e4a2172ef4fa94320ddf35756f92d8089e1a980 /testsuite/Testlib/TestServer/TestPlugins/TestProbes.py
parent554022ae751777a6f853f54663dc5e9fab818dce (diff)
downloadbcfg2-be4f6ad065fa17ae34c810f2c09bc9f5fa4d9c23.tar.gz
bcfg2-be4f6ad065fa17ae34c810f2c09bc9f5fa4d9c23.tar.bz2
bcfg2-be4f6ad065fa17ae34c810f2c09bc9f5fa4d9c23.zip
added unit tests for EntrySet
Diffstat (limited to 'testsuite/Testlib/TestServer/TestPlugins/TestProbes.py')
-rw-r--r--testsuite/Testlib/TestServer/TestPlugins/TestProbes.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/testsuite/Testlib/TestServer/TestPlugins/TestProbes.py b/testsuite/Testlib/TestServer/TestPlugins/TestProbes.py
index f90096210..0bcb65dc4 100644
--- a/testsuite/Testlib/TestServer/TestPlugins/TestProbes.py
+++ b/testsuite/Testlib/TestServer/TestPlugins/TestProbes.py
@@ -3,7 +3,7 @@ import sys
import time
import unittest
import lxml.etree
-from mock import Mock, patch
+from mock import Mock, MagicMock, patch
from ....common import *
import Bcfg2.Server
import Bcfg2.Server.Plugin
@@ -75,18 +75,27 @@ class TestProbeData(Bcfg2TestCase):
class TestProbeSet(TestEntrySet):
test_obj = ProbeSet
+ basenames = ["test", "_test", "test-test"]
+ ignore = ["foo~", ".#foo", ".foo.swp", ".foo.swx", "probed.xml"]
+ bogus_names = ["test.py"]
def get_obj(self, path=datastore, fam=None, encoding=None,
- plugin_name="Probes"):
+ plugin_name="Probes", basename=None):
+ # get_obj() accepts the basename argument, accepted by the
+ # parent get_obj() method, and just throws it away, since
+ # ProbeSet uses a regex for the "basename"
if fam is None:
fam = Mock()
- return self.test_obj(path, fam, encoding, plugin_name)
+ rv = self.test_obj(path, fam, encoding, plugin_name)
+ rv.entry_type = MagicMock()
+ return rv
def test__init(self):
fam = Mock()
ps = self.get_obj(fam=fam)
self.assertEqual(ps.plugin_name, "Probes")
fam.AddMonitor.assert_called_with(datastore, ps)
+ TestEntrySet.test__init(self)
def test_HandleEvent(self):
ps = self.get_obj()