def add_role(name): """Add New Role""" r = Role() r.name = name r.save() print(f'{r.name} | added.')
def test_roles(self): """Add a role to a user.""" role = Role(name="admin") role.save() user = UserFactory() user.roles.append(role) user.save() assert role in user.roles
def add_role(name): """ Add New User Role """ try: r = Role() r.set_name(name) r.description = 'Default Description' r.save() except Exception as exp: print(exp) else: print(r.__repr__()) del r