def get_group(self, groupname): secClient1 = SecurityClient(base_url, username1, password1) try: secClient1.get_group(groupname) except Exception, exception: message = "group '%s' not found" % groupname raise AssertionError(message)
def delete_group_member(self, groupname, username): secClient1 = SecurityClient(base_url, username1, password1) try: secClient1.delete_group_members(groupname, username) group1 = secClient1.get_group(groupname) group1members = group1.members group1membersnames = group1members.name group1memberslength = len(group1membersnames) countvalue = 0 userfound = 0 while (countvalue < group1memberslength): name = str(group1memberssnames[countvalue]) if (name == username): userfound = 1 else: userfound = 0 countvalue = countvalue + 1 if userfound == 0: print "%s deleted from group" % username else: message = "%s not deleted from group" % username raise AssertionError(message) except Exception, exception: message = "FAIL %s not deleted from group" % username raise AssertionError(message)
def add_group_admin(self, groupname, username): secClient1 = SecurityClient(base_url, username1, password1) try: secClient1.add_group_admin(groupname, username) group1 = secClient1.get_group(groupname) group1admins = group1.admins group1adminsnames = group1admins.name group1adminslength = len(group1adminsnames) countvalue = 0 userfound = 0 while (countvalue < group1adminslength): name = str(group1adminsnames[countvalue]) if (name == username): userfound = 1 else: print "something" countvalue = countvalue + 1 if userfound == 1: print "%s added to group" % username else: message = "%s not added to group" % username raise AssertionError(message) except Exception, exception: message = "%s not added to group" % username raise AssertionError(message)
def delete_group_admin_and_expect_error(self, groupname, username): secClient1 = SecurityClient(base_url, username1, password1) try: secClient1.delete_group_admin(groupname, username) group1 = secClient1.get_group(groupname) group1admins = group1.admins group1adminsnames = group1admins.name group1adminslength = len(group1adminsnames) countvalue = 0 userfound = 0 while (countvalue < group1adminslength): name = str(group1adminsnames[countvalue]) if (name == username): userfound = 1 else: print "'%s user not found" % username countvalue = countvalue + 1 if userfound == 1: message = "%s deleted from group" % username raise AssertionError(message) else: print "%s not deleted from group" % username except AssertionError: raise AssertionError(message) except Exception, exception: print "%s not deleted from group" % username
def update_group(self, groupname, updateddescription): secClient1 = SecurityClient(base_url, username1, password1) try: secClient1.update_group(groupname, updateddescription) group1 = secClient1.get_group(groupname) group1description = group1.description group1descriptionstring = str(group1description) if group1descriptionstring == updateddescription: print "Group '%s' updated" % groupname else: message = "group '%s' not updted" % groupname raise AssertionError(message) except Exception, exception: message = "group '%s' not updated" % groupname raise AssertionError(message)