##// END OF EJS Templates
Added ini config maker with dynamic variable replacements....
Added ini config maker with dynamic variable replacements. Used internally for creating dynamic configs in automated enviroments. Later this will replace old make-config from paster

File last commit:

r3646:63e49418 beta
r4011:4959e22a default
Show More
test_forks.py
176 lines | 6.7 KiB | text/x-python | PythonLexer
added tests for forks and followers pages
r1375 from rhodecode.tests import *
from rhodecode.model.db import Repository
fixed missing permissions check on forks page
r2176 from rhodecode.model.repo import RepoModel
from rhodecode.model.user import UserModel
RhodeCode now has a option to explicitly set forking permissions. ref #508...
r2709 from rhodecode.model.meta import Session
fixed missing permissions check on forks page
r2176
added tests for forks and followers pages
r1375
class TestForksController(TestController):
fixed missing permissions check on forks page
r2176 def setUp(self):
self.username = u'forkuser'
self.password = u'qweqwe'
self.u1 = UserModel().create_or_update(
username=self.username, password=self.password,
Updated create_or_update method to not change API key when password is not updated
r2513 email=u'fork_king@rhodecode.org', firstname=u'u1', lastname=u'u1'
fixed missing permissions check on forks page
r2176 )
RhodeCode now has a option to explicitly set forking permissions. ref #508...
r2709 Session().commit()
fixed missing permissions check on forks page
r2176
def tearDown(self):
RhodeCode now has a option to explicitly set forking permissions. ref #508...
r2709 Session().delete(self.u1)
Session().commit()
fixed missing permissions check on forks page
r2176
added tests for forks and followers pages
r1375 def test_index(self):
self.log_user()
repo_name = HG_REPO
response = self.app.get(url(controller='forks', action='forks',
repo_name=repo_name))
Use only mustcontain for testing response body
r3646 response.mustcontain("""There are no forks yet""")
added tests for forks and followers pages
r1375
RhodeCode now has a option to explicitly set forking permissions. ref #508...
r2709 def test_no_permissions_to_fork(self):
usr = self.log_user(TEST_USER_REGULAR_LOGIN,
TEST_USER_REGULAR_PASS)['user_id']
user_model = UserModel()
user_model.revoke_perm(usr, 'hg.fork.repository')
user_model.grant_perm(usr, 'hg.fork.none')
u = UserModel().get(usr)
u.inherit_default_permissions = False
Session().commit()
# try create a fork
repo_name = HG_REPO
self.app.post(url(controller='forks', action='fork_create',
repo_name=repo_name), {}, status=403)
Initial version of landing revisions ref #483...
r2459 def test_index_with_fork_hg(self):
added tests for forks and followers pages
r1375 self.log_user()
# create a fork
fork_name = HG_FORK
description = 'fork of vcs test'
repo_name = HG_REPO
- refactoring to overcome poor usage of global pylons config...
r1723 org_repo = Repository.get_by_repo_name(repo_name)
response = self.app.post(url(controller='forks',
added tests for forks and followers pages
r1375 action='fork_create',
repo_name=repo_name),
Initial version of landing revisions ref #483...
r2459 {'repo_name': fork_name,
'repo_group': '',
'fork_parent_id': org_repo.repo_id,
'repo_type': 'hg',
'description': description,
'private': 'False',
'landing_rev': 'tip'})
added tests for forks and followers pages
r1375
response = self.app.get(url(controller='forks', action='forks',
repo_name=repo_name))
Initial version of landing revisions ref #483...
r2459 response.mustcontain(
fixed tests
r3291 """<a href="/%s">%s</a>""" % (fork_name, fork_name)
Initial version of landing revisions ref #483...
r2459 )
#remove this fork
response = self.app.delete(url('repo', repo_name=fork_name))
def test_index_with_fork_git(self):
self.log_user()
# create a fork
fork_name = GIT_FORK
description = 'fork of vcs test'
repo_name = GIT_REPO
org_repo = Repository.get_by_repo_name(repo_name)
response = self.app.post(url(controller='forks',
action='fork_create',
repo_name=repo_name),
{'repo_name': fork_name,
'repo_group': '',
'fork_parent_id': org_repo.repo_id,
'repo_type': 'git',
'description': description,
'private': 'False',
'landing_rev': 'tip'})
response = self.app.get(url(controller='forks', action='forks',
repo_name=repo_name))
response.mustcontain(
fixed tests
r3291 """<a href="/%s">%s</a>""" % (fork_name, fork_name)
Initial version of landing revisions ref #483...
r2459 )
added tests for forks and followers pages
r1375
#remove this fork
response = self.app.delete(url('repo', repo_name=fork_name))
- refactoring to overcome poor usage of global pylons config...
r1723 def test_z_fork_create(self):
self.log_user()
fork_name = HG_FORK
description = 'fork of vcs test'
repo_name = HG_REPO
org_repo = Repository.get_by_repo_name(repo_name)
response = self.app.post(url(controller='forks', action='fork_create',
repo_name=repo_name),
Repo size - show just the size without duplicating text...
r3550 {'repo_name': fork_name,
- refactoring to overcome poor usage of global pylons config...
r1723 'repo_group':'',
'fork_parent_id':org_repo.repo_id,
'repo_type':'hg',
'description':description,
Initial version of landing revisions ref #483...
r2459 'private':'False',
'landing_rev': 'tip'})
- refactoring to overcome poor usage of global pylons config...
r1723
#test if we have a message that fork is ok
Initial version of landing revisions ref #483...
r2459 self.checkSessionFlash(response,
Mads Kiilerich
consistently capitalize initial letter in flash messages
r3565 'Forked repository %s as <a href="/%s">%s</a>'
Repo size - show just the size without duplicating text...
r3550 % (repo_name, fork_name, fork_name))
- refactoring to overcome poor usage of global pylons config...
r1723
#test if the fork was created in the database
RhodeCode now has a option to explicitly set forking permissions. ref #508...
r2709 fork_repo = Session().query(Repository)\
- refactoring to overcome poor usage of global pylons config...
r1723 .filter(Repository.repo_name == fork_name).one()
self.assertEqual(fork_repo.repo_name, fork_name)
self.assertEqual(fork_repo.fork.repo_name, repo_name)
#test if fork is visible in the list ?
response = response.follow()
response = self.app.get(url(controller='summary', action='index',
repo_name=fork_name))
Use only mustcontain for testing response body
r3646 response.mustcontain('Fork of %s' % repo_name)
fixed missing permissions check on forks page
r2176
def test_zz_fork_permission_page(self):
usr = self.log_user(self.username, self.password)['user_id']
repo_name = HG_REPO
RhodeCode now has a option to explicitly set forking permissions. ref #508...
r2709 forks = Session().query(Repository)\
fixed missing permissions check on forks page
r2176 .filter(Repository.fork_id != None)\
.all()
self.assertEqual(1, len(forks))
# set read permissions for this
RepoModel().grant_user_permission(repo=forks[0],
user=usr,
perm='repository.read')
RhodeCode now has a option to explicitly set forking permissions. ref #508...
r2709 Session().commit()
fixed missing permissions check on forks page
r2176
response = self.app.get(url(controller='forks', action='forks',
repo_name=repo_name))
response.mustcontain('<div style="padding:5px 3px 3px 42px;">fork of vcs test</div>')
def test_zzz_fork_permission_page(self):
usr = self.log_user(self.username, self.password)['user_id']
repo_name = HG_REPO
RhodeCode now has a option to explicitly set forking permissions. ref #508...
r2709 forks = Session().query(Repository)\
fixed missing permissions check on forks page
r2176 .filter(Repository.fork_id != None)\
.all()
self.assertEqual(1, len(forks))
# set none
RepoModel().grant_user_permission(repo=forks[0],
user=usr, perm='repository.none')
RhodeCode now has a option to explicitly set forking permissions. ref #508...
r2709 Session().commit()
fixed missing permissions check on forks page
r2176 # fork shouldn't be there
response = self.app.get(url(controller='forks', action='forks',
repo_name=repo_name))
response.mustcontain('There are no forks yet')