def user_create(user, password, is_admin=False): """Create user with given password. If the user already exists, a DuplicateError will be raised. """ get_auth_backend().require_admin() # XXX: We need to do a bit of refactoring, so this is available outside of # haas.api: api._assert_absent(User, user) user = User(user, password, is_admin=is_admin) db.session.add(user) db.session.commit()
def test_new_user(self): api._assert_absent(User, 'charlie') user_create('charlie', 'foo')
def test_new_user(self): api._assert_absent(self.dbauth.User, 'charlie') self.dbauth.user_create('charlie', 'foo')