Changeset - aef5f5ce5ead
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 13 years ago 2013-03-31 21:31:36
marcin@python-works.com
use fixtures for forking
2 files changed with 7 insertions and 34 deletions:
0 comments (0 inline, 0 general)
rhodecode/tests/functional/test_admin_repos.py
Show inline comments
 
@@ -23,9 +23,6 @@ def _get_permission_for_user(user, repo)
 

	
 
class TestAdminReposController(TestController):
 

	
 
    def __make_repo(self):
 
        pass
 

	
 
    def test_index(self):
 
        self.log_user()
 
        response = self.app.get(url('repos'))
rhodecode/tests/functional/test_compare.py
Show inline comments
 
@@ -4,33 +4,9 @@ from rhodecode.model.meta import Session
 
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 @@ class TestCompareController(TestControll
 
                             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 @@ class TestCompareController(TestControll
 
                             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 @@ class TestCompareController(TestControll
 
        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 @@ class TestCompareController(TestControll
 
        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 @@ class TestCompareController(TestControll
 
    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'
0 comments (0 inline, 0 general)