def get_user(self, username): secClient1 = SecurityClient(base_url, username1, password1) try: secClient1.get_user(username) except Exception, exception: message = "user '%s' not found" % username raise AssertionError(message)
def get_user_and_expect_error(self, username): secClient1 = SecurityClient(base_url, username1, password1) try: secClient1.get_user(username) message = "user '%s' found" % username raise AssertionError(message) except AssertionError: raise AssertionError(message) except Exception, exception: print exception print "user '%s' not found" % username
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 update_user(self, username, fullname, email, department, isadmin): secClient1 = SecurityClient(base_url, username1, password1) try: secClient1.update_user(username, fullname, email, department, isadmin) user1 = secClient1.get_user(username) user1username = str(user1.username) user1fullname = str(user1.fullname) user1password = str(user1.password) user1department = str(user1.department) print user1username print user1fullname print user1password print user1department if user1username != username: message = "username '%s' not found" % username raise AssertionError(message) elif user1fullname != fullname: message = "fullname '%s' not found" % fullname raise AssertionError(message) elif user1password != password: message = "password '%s' not found" % password raise AsserttionError(message) elif user1department != department: message = "department '%s' not found" % department raise AssertionError(message) else: print "User successfully updated" except Exception, exception: message = exception #"User not updated succesfully" raise AssertionError(message)
def check_user_details(self, username, fullname, email, department, isadmin): secClient1 = SecurityClient(base_url, username1, password1) try: user1 = secClient1.get_user(username) user1username = str(user1.userName) user1fullname = str(user1.userFullName) user1department = str(user1.department) print user1username print user1fullname print user1department if user1username != username: message = "username '%s' not found" % username raise AssertionError(message) elif user1fullname != fullname: message = "fullname '%s' not found" % fullname raise AssertionError(message) elif user1department != department: message = "department '%s' not found" % department raise AssertionError(message) else: print "User successfully validated" except Exception, exception: message = exception #"User not validated succesfully" 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
def create_user(self, username, password, fullname, email, department, isadmin): print "HERE" secClient1 = SecurityClient(base_url, username1, password1, 'xml') print "HERE" try: secClient1.create_user(username, password, fullname, email, department, isadmin) user1 = secClient1.get_user(username) user1username = str(user1.userName) user1fullname = str(user1.userFullName) user1department = str(user1.department) user1emails = user1.email user1email = str(user1emails.email) user1emailvalidate = '["' + email + '"]' print user1username print user1fullname print user1department print user1email print user1emailvalidate if user1username != username: message = "username '%s' not found" % username raise AssertionError(message) elif user1fullname != fullname: message = "fullname '%s' not found" % fullname raise AsserttionError(message) elif user1department != department: message = "department '%s' not found" % department raise AssertionError(message) elif user1email != user1emailvalidate: message = "email address '%s' not found" % email raise AssertionError(message) else: print "User successfully created" except Exception, exception: message = exception #"User not created succesfully" raise AssertionError(message)