summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authormakkalot <makkalot@gmail.com>2008-07-31 18:39:42 +0300
committermakkalot <makkalot@gmail.com>2008-07-31 18:39:42 +0300
commit9bc72b2c3a882e69267f878272df80a7ac35b30e (patch)
tree60f001ccc6ee6b6c9e1af9b1bef3306ee1ece13c /test
parent963f423b09a5999ecd9e67aecbac4161d1c327b8 (diff)
downloadfunc-9bc72b2c3a882e69267f878272df80a7ac35b30e.tar.gz
func-9bc72b2c3a882e69267f878272df80a7ac35b30e.tar.xz
func-9bc72b2c3a882e69267f878272df80a7ac35b30e.zip
add more methods for groups api
Diffstat (limited to 'test')
-rw-r--r--test/unittest/test_groups.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/unittest/test_groups.py b/test/unittest/test_groups.py
index 56e7c2a..96ad29b 100644
--- a/test/unittest/test_groups.py
+++ b/test/unittest/test_groups.py
@@ -57,6 +57,7 @@ class TestGroupsBase(object):
#def test_expand_servers(self):
# result = self.minions.get_urls()
# print result
+ assert result == self.util_save_change()
def test_get_groups(self):
#will reset on every test
@@ -64,6 +65,11 @@ class TestGroupsBase(object):
result = self.minions.group_class.get_groups()
assert self.test_dict == result
+ def test_get_group_names(self):
+ self.setUp()
+ result = self.minions.group_class.get_group_names()
+ assert self.test_dict.keys() == result
+
def test_add_hosts_to_group(self):
self.setUp()
@@ -90,6 +96,19 @@ class TestGroupsBase(object):
self.test_dict["home_group"].append("bloop")
assert self.test_dict == result
+ def test_add_host_list(self):
+
+ self.setUp()
+ self.minions.group_class.add_host_list("home_group",["bloop","woop","zoo"])
+ self.test_dict["home_group"].extend(["bloop","woop","zoo"])
+ result = self.minions.group_class.get_groups()
+ assert self.test_dict == result
+
+ #add one for save
+ self.minions.group_class.add_host_list("home_group",["hey.com"],save = True)
+ result = self.minions.group_class.get_groups()
+ assert result == self.util_save_change()
+
def test_save_changes(self):
self.setUp()
@@ -138,7 +157,22 @@ class TestGroupsBase(object):
#print "The result we got is : ",result
#print "The data from file is :i ",self.util_save_change()
assert result == self.util_save_change()
+
+ def test_remove_host_list(self):
+ self.setUp()
+ self.minions.group_class.remove_host_list("home_group",["first","second"])
+ self.test_dict["home_group"].remove("first")
+ self.test_dict["home_group"].remove("second")
+ result = self.minions.group_class.get_groups()
+ assert self.test_dict == result
+ #also check the save situation
+ self.minions.group_class.add_host_to_group("home_group","bloop")
+ self.minions.group_class.remove_host_list("home_group",["bloop"],save = True)
+ result = self.minions.group_class.get_groups()
+ assert result == self.util_save_change()
+
+
def test_add_group(self):
self.setUp()
self.minions.group_class.add_group("lab_group")