summaryrefslogtreecommitdiffstats
path: root/test/unittest
diff options
context:
space:
mode:
authorAdrian Likins <alikins@redhat.com>2008-07-16 13:05:02 -0400
committerAdrian Likins <alikins@redhat.com>2008-07-16 13:05:02 -0400
commitcb311639535aa5a1bf80bfeb3cbf1954df472c5c (patch)
treeecbea965cf5abc4a3a90cbc0b0c4f9464c73334b /test/unittest
parent139d9ab8bc7deae4c1167bc5da1ffb478c433037 (diff)
downloadfunc-cb311639535aa5a1bf80bfeb3cbf1954df472c5c.tar.gz
func-cb311639535aa5a1bf80bfeb3cbf1954df472c5c.tar.xz
func-cb311639535aa5a1bf80bfeb3cbf1954df472c5c.zip
func-transmit: handle lists of client globs. Not sure this is the correct
approach, but it seems to mostly work for now test_func_transmit.py: more test cases for func-transmit
Diffstat (limited to 'test/unittest')
-rw-r--r--test/unittest/test_func_transmit.py52
1 files changed, 51 insertions, 1 deletions
diff --git a/test/unittest/test_func_transmit.py b/test/unittest/test_func_transmit.py
index 70578ec..2c5fa23 100644
--- a/test/unittest/test_func_transmit.py
+++ b/test/unittest/test_func_transmit.py
@@ -69,7 +69,57 @@ class TestListMinion(BaseTest):
out = self.call({'clients': '*',
'method': 'list_minions'})
- print out
+ def test_list_minions_no_match(self):
+ out = self.call({'clients': 'somerandom-name-that-shouldnt-be-a_real_host_name',
+ 'method': 'list_minions'})
+ assert out == []
+
+ def test_list_minions_group_name(self):
+ out = self.call({'clients': '@test',
+ 'method': 'list_minions'})
+
+ def test_list_minions_no_clients(self):
+ out = self.call({'method': 'list_minions'})
+
+
+
+class TestClientGlob(BaseTest):
+
+ def _test_add(self, client):
+ result = self.call({'clients': client,
+ 'method': 'add',
+ 'module': 'test',
+ 'parameters': [1,2]})
+ self.assert_on_fault(result)
+ return result
+
+ def test_single_client(self):
+ result = self._test_add(self.th)
+
+ def test_glob_client(self):
+ result = self._test_add("*")
+
+ def test_glob_list(self):
+ result = self._test_add([self.th, self.th])
+
+ def test_glob_string_list(self):
+ result = self._test_add("%s;*" % self.th)
+
+ # note, needs a /etc/func/group setup with the proper groups defined
+ # need to figure out a good way to test this... -akl
+ def test_group(self):
+ result = self._test_add("@test")
+
+ def test_group_and_glob(self):
+ result = self._test_add("@test;*")
+
+ def test_list_of_groups(self):
+ result = self._test_add(["@test", "@test2"])
+
+ def test_string_list_of_groups(self):
+ result = self._test_add("@test;@test2")
+
+
class TestTest(BaseTest):