def create_role(self, rolename, roledisplayname, roledescription, issystemrole): secClient1 = SecurityClient(base_url, username1, password1, 'xml') try: secClient1.create_role(rolename, roledisplayname, roledescription, issystemrole) role1 = secClient1.get_role(rolename) role1name = str(role1.name) role1dispname = str(role1.displayName) role1desc = str(role1.description) systemrole = str(role1.systemRole) if systemrole == 'True': systemrole = 'true' else: systemrole = 'false' if role1name != rolename: message = "role name doesn't match" raise AssertionError(message) elif role1dispname != roledisplayname: message = "role display name doesn't match" raise AssertionError(message) elif role1desc != roledescription: message = "role description doesn't match" raise AssertionError(message) elif systemrole != issystemrole: message = "system role flag doesn't match" raise AssertionError(message) else: print "created role validated" except Exception, exception: message = exception #"Role not found" raise AssertionError(message)
def create_role_and_expect_error(self, rolename, roledisplayname, roledescription, issystemrole): secClient1 = SecurityClient(base_url, username1, password1, 'xml') try: secClient1.create_role(rolename, roledisplayname, roledescription, issystemrole) message = "Role '%s' created" % rolename raise AssertionError(message) except AssertionError: raise AssertionError(message) except Exception, exception: print exception print "Role '%s' not created" % rolename