def add_role_permission_and_expect_error(self, rolename, permissionname): secClient1 = SecurityClient(base_url, username1, password1) try: secClient1.add_role_permission(rolename, permissionname) message = "permission '%s' added to role" % permissionname raise AssertionError(message) except AssertionError: raise AssertionError(message) except Exception, exception: print exception
def add_role_permission(self, rolename, permissionname): secClient1 = SecurityClient(base_url, username1, password1) try: secClient1.add_role_permission(rolename, permissionname) role1 = secClient1.get_role(rolename) role1permissions = role1.permissions role1permissionnames = str(role1permissions.name) if permissionname in role1permissionnames: print "permission '%s' added to role" % permissionname else: message = "permission '%s' not added to role" % permissionname raise AssertionError(message) except Exception, exception: message = exception #"Permission not added to role" raise AssertionError(message)