##// 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 class TestAdminReposController(TestController):
24 class TestAdminReposController(TestController):
25
25
26 def __make_repo(self):
27 pass
28
29 def test_index(self):
26 def test_index(self):
30 self.log_user()
27 self.log_user()
31 response = self.app.get(url('repos'))
28 response = self.app.get(url('repos'))
@@ -4,33 +4,9 b' from rhodecode.model.meta import Session'
4 from rhodecode.model.db import Repository
4 from rhodecode.model.db import Repository
5 from rhodecode.model.scm import ScmModel
5 from rhodecode.model.scm import ScmModel
6 from rhodecode.lib.vcs.backends.base import EmptyChangeset
6 from rhodecode.lib.vcs.backends.base import EmptyChangeset
7
7 from rhodecode.tests.fixture import Fixture
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
17
8
18 form_data = dict(
9 fixture = Fixture()
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)
34
10
35
11
36 def _commit_change(repo, filename, content, message, vcs_type, parent=None, newfile=False):
12 def _commit_change(repo, filename, content, message, vcs_type, parent=None, newfile=False):
@@ -86,7 +62,7 b' class TestCompareController(TestControll'
86 message='commit1', vcs_type='hg', parent=None, newfile=True)
62 message='commit1', vcs_type='hg', parent=None, newfile=True)
87
63
88 #fork this repo
64 #fork this repo
89 repo2 = _fork_repo('one-fork', 'hg', parent='one')
65 repo2 = fixture.create_fork('one', 'one-fork')
90 self.r2_id = repo2.repo_id
66 self.r2_id = repo2.repo_id
91
67
92 #add two extra commit into fork
68 #add two extra commit into fork
@@ -137,7 +113,7 b' class TestCompareController(TestControll'
137 message='commit1', vcs_type='hg', parent=None, newfile=True)
113 message='commit1', vcs_type='hg', parent=None, newfile=True)
138
114
139 #fork this repo
115 #fork this repo
140 repo2 = _fork_repo('one-fork', 'hg', parent='one')
116 repo2 = fixture.create_fork('one', 'one-fork')
141 self.r2_id = repo2.repo_id
117 self.r2_id = repo2.repo_id
142
118
143 #now commit something to origin repo
119 #now commit something to origin repo
@@ -205,7 +181,7 b' class TestCompareController(TestControll'
205 cs1 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\n',
181 cs1 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\n',
206 message='commit2', vcs_type='hg', parent=cs0)
182 message='commit2', vcs_type='hg', parent=cs0)
207 #fork this repo
183 #fork this repo
208 repo2 = _fork_repo('repo1-fork', 'hg', parent='repo1')
184 repo2 = fixture.create_fork('repo1', 'repo1-fork')
209 self.r2_id = repo2.repo_id
185 self.r2_id = repo2.repo_id
210 #now make cs3-6
186 #now make cs3-6
211 cs2 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\n',
187 cs2 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\n',
@@ -267,7 +243,7 b' class TestCompareController(TestControll'
267 cs1 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\n',
243 cs1 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\n',
268 message='commit2', vcs_type='hg', parent=cs0)
244 message='commit2', vcs_type='hg', parent=cs0)
269 #fork this repo
245 #fork this repo
270 repo2 = _fork_repo('repo1-fork', 'hg', parent='repo1')
246 repo2 = fixture.create_fork('repo1', 'repo1-fork')
271 self.r2_id = repo2.repo_id
247 self.r2_id = repo2.repo_id
272 #now make cs3-6
248 #now make cs3-6
273 cs2 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\n',
249 cs2 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\n',
@@ -311,7 +287,7 b' class TestCompareController(TestControll'
311 def test_compare_remote_branches_hg(self):
287 def test_compare_remote_branches_hg(self):
312 self.log_user()
288 self.log_user()
313
289
314 repo2 = _fork_repo(HG_FORK, 'hg')
290 repo2 = fixture.create_fork(HG_REPO, HG_FORK)
315 self.r2_id = repo2.repo_id
291 self.r2_id = repo2.repo_id
316 rev1 = '56349e29c2af'
292 rev1 = '56349e29c2af'
317 rev2 = '7d4bc8ec6be5'
293 rev2 = '7d4bc8ec6be5'
General Comments 0
You need to be logged in to leave comments. Login now