# -*- coding: utf-8 -*- # Copyright (C) 2010-2017 RhodeCode GmbH # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License, version 3 # (only), as published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # # This program is dual-licensed. If you wish to learn more about the # RhodeCode Enterprise Edition, including its added features, Support services, # and proprietary license terms, please see https://rhodecode.com/licenses/ import os from rhodecode.lib import helpers as h from rhodecode.model.meta import Session from rhodecode.model.repo_group import RepoGroupModel from rhodecode.tests import ( url, TestController, assert_session_flash, GIT_REPO, HG_REPO, TESTS_TMP_PATH, TEST_USER_REGULAR_LOGIN, TEST_USER_REGULAR_PASS) from rhodecode.tests.fixture import Fixture fixture = Fixture() def test_update(app, csrf_token, autologin_user, user_util): repo_group = user_util.create_repo_group() description = 'description for newly created repo group' Session().commit() response = app.post( url('update_repo_group', group_name=repo_group.group_name), fixture._get_group_create_params( group_name=repo_group.group_name, group_description=description, csrf_token=csrf_token, _method='PUT') ) # TODO: anderson: johbo: we believe that this update should return # a redirect instead of rendering the template. assert response.status_code == 200 def test_edit(app, user_util, autologin_user): repo_group = user_util.create_repo_group() Session().commit() response = app.get( url('edit_repo_group', group_name=repo_group.group_name)) assert response.status_code == 200 def test_edit_repo_group_perms(app, user_util, autologin_user): repo_group = user_util.create_repo_group() Session().commit() response = app.get( url('edit_repo_group_perms', group_name=repo_group.group_name)) assert response.status_code == 200 def test_update_fails_when_parent_pointing_to_self( app, csrf_token, user_util, autologin_user): group = user_util.create_repo_group() response = app.post( url('update_repo_group', group_name=group.group_name), fixture._get_group_create_params( group_parent_id=group.group_id, csrf_token=csrf_token, _method='PUT') ) response.mustcontain( '