def enable_disable_user(self, username, comment, disable): secClient1 = SecurityClient(base_url, username1, password1) try: secClient1.enable_disable_user(username, comment, disable) except Exception, exception: message = exception #"User not disabled or enabled succesfully" raise AssertionError(message)
def disable_user(self, username, disable_reason): secClient1 = SecurityClient(base_url, username1, password1, 'xml') user1 = secClient1.get_user(username) user1status = str(user1.disabled) if user1status == 'True': print "user already disabled" else: secClient1.enable_disable_user(username, disable_reason, 'true') user2 = secClient1.get_user(username) user2status = str(user2.disabled) if user2status == 'True': print "user disabled" else: message = "user not disabled" raise AssertionError(message)
def enable_user(self, username): secClient1 = SecurityClient(base_url, username1, password1, 'xml') user1 = secClient1.get_user(username) user1status = str(user1.disabled) if user1status == 'False': print "user already enabled" else: secClient1.enable_disable_user(username, 'enabled', 'false') user2 = secClient1.get_user(username) user2status = str(user2.disabled) if user2status == 'False': print "user enabled" else: message = "user not enabled" raise AssertionError(message)
def enable_user_and_expect_error(self, username): secClient1 = SecurityClient(base_url, username1, password1, 'xml') user1 = secClient1.get_user(username) user1status = str(user1.disabled) try: if user1status == 'False': print "user already enabled" else: secClient1.enable_disable_user(username, 'enabled', 'false') message = "user enabled" raise AssertionError(message) except AssertionError: raise AssertionError(message) except Exception, exception: print exception print "user '%s' not enabled" % username