# HG changeset patch # User Marcin Kuzminski # Date 1364758296 -7200 # Node ID aef5f5ce5ead52556b4f61a42ffdc0c80a8763f0 # Parent 71860d0737e74aaf10e5aecd55bfa19b4990add0 use fixtures for forking diff -r 71860d0737e7 -r aef5f5ce5ead rhodecode/tests/functional/test_admin_repos.py --- a/rhodecode/tests/functional/test_admin_repos.py Sun Mar 31 19:31:50 2013 +0200 +++ b/rhodecode/tests/functional/test_admin_repos.py Sun Mar 31 21:31:36 2013 +0200 @@ -23,9 +23,6 @@ class TestAdminReposController(TestController): - def __make_repo(self): - pass - def test_index(self): self.log_user() response = self.app.get(url('repos')) diff -r 71860d0737e7 -r aef5f5ce5ead rhodecode/tests/functional/test_compare.py --- a/rhodecode/tests/functional/test_compare.py Sun Mar 31 19:31:50 2013 +0200 +++ b/rhodecode/tests/functional/test_compare.py Sun Mar 31 21:31:36 2013 +0200 @@ -4,33 +4,9 @@ from rhodecode.model.db import Repository from rhodecode.model.scm import ScmModel from rhodecode.lib.vcs.backends.base import EmptyChangeset - - -def _fork_repo(fork_name, vcs_type, parent=None): - if vcs_type =='hg': - _REPO = HG_REPO - elif vcs_type == 'git': - _REPO = GIT_REPO - - if parent: - _REPO = parent +from rhodecode.tests.fixture import Fixture - form_data = dict( - repo_name=fork_name, - repo_name_full=fork_name, - repo_group=None, - repo_type=vcs_type, - description='', - private=False, - copy_permissions=False, - landing_rev='tip', - update_after_clone=False, - fork_parent_id=Repository.get_by_repo_name(_REPO), - ) - RepoModel().create_fork(form_data, cur_user=TEST_USER_ADMIN_LOGIN) - - Session().commit() - return Repository.get_by_repo_name(fork_name) +fixture = Fixture() def _commit_change(repo, filename, content, message, vcs_type, parent=None, newfile=False): @@ -86,7 +62,7 @@ message='commit1', vcs_type='hg', parent=None, newfile=True) #fork this repo - repo2 = _fork_repo('one-fork', 'hg', parent='one') + repo2 = fixture.create_fork('one', 'one-fork') self.r2_id = repo2.repo_id #add two extra commit into fork @@ -137,7 +113,7 @@ message='commit1', vcs_type='hg', parent=None, newfile=True) #fork this repo - repo2 = _fork_repo('one-fork', 'hg', parent='one') + repo2 = fixture.create_fork('one', 'one-fork') self.r2_id = repo2.repo_id #now commit something to origin repo @@ -205,7 +181,7 @@ cs1 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\n', message='commit2', vcs_type='hg', parent=cs0) #fork this repo - repo2 = _fork_repo('repo1-fork', 'hg', parent='repo1') + repo2 = fixture.create_fork('repo1', 'repo1-fork') self.r2_id = repo2.repo_id #now make cs3-6 cs2 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\n', @@ -267,7 +243,7 @@ cs1 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\n', message='commit2', vcs_type='hg', parent=cs0) #fork this repo - repo2 = _fork_repo('repo1-fork', 'hg', parent='repo1') + repo2 = fixture.create_fork('repo1', 'repo1-fork') self.r2_id = repo2.repo_id #now make cs3-6 cs2 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\n', @@ -311,7 +287,7 @@ def test_compare_remote_branches_hg(self): self.log_user() - repo2 = _fork_repo(HG_FORK, 'hg') + repo2 = fixture.create_fork(HG_REPO, HG_FORK) self.r2_id = repo2.repo_id rev1 = '56349e29c2af' rev2 = '7d4bc8ec6be5'