def create_user_no_check(self, username, password, fullname, email, department, isadmin): secClient1 = SecurityClient(base_url, username1, password1, 'xml') try: secClient1.create_user(username, password, fullname, email, department, isadmin) except Exception, exception: print exception
def create_user_and_expect_error(self, username, password, fullname, email, department, isadmin): secClient1 = SecurityClient(base_url, username1, password1, 'xml') try: secClient1.create_user(username, password, fullname, email, department, isadmin) """ try: user1 = secClient1.find_users(username) if len(user1) == 1: user1username = str(user1.userName) user1fullname = str(user1.userFullName) user1department = str(user1.department) if user1username == username: message = "Username '%s' found" % username raise AssertionError(message) elif user1fullname == fullname: message = "fullname '%s' found" % fullname raise AssertionError(message) elif user1department == department: message = "department '%s' found" % department raise AssertionError(message) else: message = "Username '%s' not found" % username raise Exception(message) else: raise Exception(message) except Exception, exception: message = exception raise Exception(message) """ message = "User '%s' created" % username print 'User has been created' raise AssertionError(message) except AssertionError: raise AssertionError(message) except Exception, exception: print exception print "User '%s' not created" % 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)