##// END OF EJS Templates
use fixtures for forking
marcink -
r3645:aef5f5ce beta
parent child Browse files
Show More
@@ -23,9 +23,6 b' def _get_permission_for_user(user, repo)'
23 23
24 24 class TestAdminReposController(TestController):
25 25
26 def __make_repo(self):
27 pass
28
29 26 def test_index(self):
30 27 self.log_user()
31 28 response = self.app.get(url('repos'))
@@ -4,33 +4,9 b' from rhodecode.model.meta import Session'
4 4 from rhodecode.model.db import Repository
5 5 from rhodecode.model.scm import ScmModel
6 6 from rhodecode.lib.vcs.backends.base import EmptyChangeset
7
8
9 def _fork_repo(fork_name, vcs_type, parent=None):
10 if vcs_type =='hg':
11 _REPO = HG_REPO
12 elif vcs_type == 'git':
13 _REPO = GIT_REPO
14
15 if parent:
16 _REPO = parent
7 from rhodecode.tests.fixture import Fixture
17 8
18 form_data = dict(
19 repo_name=fork_name,
20 repo_name_full=fork_name,
21 repo_group=None,
22 repo_type=vcs_type,
23 description='',
24 private=False,
25 copy_permissions=False,
26 landing_rev='tip',
27 update_after_clone=False,
28 fork_parent_id=Repository.get_by_repo_name(_REPO),
29 )
30 RepoModel().create_fork(form_data, cur_user=TEST_USER_ADMIN_LOGIN)
31
32 Session().commit()
33 return Repository.get_by_repo_name(fork_name)
9 fixture = Fixture()
34 10
35 11
36 12 def _commit_change(repo, filename, content, message, vcs_type, parent=None, newfile=False):
@@ -86,7 +62,7 b' class TestCompareController(TestControll'
86 62 message='commit1', vcs_type='hg', parent=None, newfile=True)
87 63
88 64 #fork this repo
89 repo2 = _fork_repo('one-fork', 'hg', parent='one')
65 repo2 = fixture.create_fork('one', 'one-fork')
90 66 self.r2_id = repo2.repo_id
91 67
92 68 #add two extra commit into fork
@@ -137,7 +113,7 b' class TestCompareController(TestControll'
137 113 message='commit1', vcs_type='hg', parent=None, newfile=True)
138 114
139 115 #fork this repo
140 repo2 = _fork_repo('one-fork', 'hg', parent='one')
116 repo2 = fixture.create_fork('one', 'one-fork')
141 117 self.r2_id = repo2.repo_id
142 118
143 119 #now commit something to origin repo
@@ -205,7 +181,7 b' class TestCompareController(TestControll'
205 181 cs1 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\n',
206 182 message='commit2', vcs_type='hg', parent=cs0)
207 183 #fork this repo
208 repo2 = _fork_repo('repo1-fork', 'hg', parent='repo1')
184 repo2 = fixture.create_fork('repo1', 'repo1-fork')
209 185 self.r2_id = repo2.repo_id
210 186 #now make cs3-6
211 187 cs2 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\n',
@@ -267,7 +243,7 b' class TestCompareController(TestControll'
267 243 cs1 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\n',
268 244 message='commit2', vcs_type='hg', parent=cs0)
269 245 #fork this repo
270 repo2 = _fork_repo('repo1-fork', 'hg', parent='repo1')
246 repo2 = fixture.create_fork('repo1', 'repo1-fork')
271 247 self.r2_id = repo2.repo_id
272 248 #now make cs3-6
273 249 cs2 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\n',
@@ -311,7 +287,7 b' class TestCompareController(TestControll'
311 287 def test_compare_remote_branches_hg(self):
312 288 self.log_user()
313 289
314 repo2 = _fork_repo(HG_FORK, 'hg')
290 repo2 = fixture.create_fork(HG_REPO, HG_FORK)
315 291 self.r2_id = repo2.repo_id
316 292 rev1 = '56349e29c2af'
317 293 rev2 = '7d4bc8ec6be5'
General Comments 0
You need to be logged in to leave comments. Login now