@@ -13,49 +13,49 @@ ADMIN_PREFIX = '/_admin'
def make_map(config):
"""Create, configure and return the routes Mapper"""
rmap = Mapper(directory=config['pylons.paths']['controllers'],
always_scan=config['debug'])
rmap.minimization = False
rmap.explicit = False
from rhodecode.lib.utils import is_valid_repo
from rhodecode.lib.utils import is_valid_repos_group
def check_repo(environ, match_dict):
"""
check for valid repository for proper 404 handling
:param environ:
:param match_dict:
from rhodecode.model.db import Repository
repo_name = match_dict.get('repo_name')
try:
by_id = repo_name.split('_')
if len(by_id) == 2 and by_id[1].isdigit():
if len(by_id) == 2 and by_id[1].isdigit() and by_id[0] == '':
repo_name = Repository.get(by_id[1]).repo_name
match_dict['repo_name'] = repo_name
except:
pass
return is_valid_repo(repo_name, config['base_path'])
def check_group(environ, match_dict):
check for valid repositories group for proper 404 handling
repos_group_name = match_dict.get('group_name')
return is_valid_repos_group(repos_group_name, config['base_path'])
def check_int(environ, match_dict):
return match_dict.get('id').isdigit()
# The ErrorController route (handles 404/500 error pages); it should
# likely stay at the top, ensuring it can always be resolved
rmap.connect('/error/{action}', controller='error')
from rhodecode.tests import *
from rhodecode.lib.utils import invalidate_cache
from rhodecode.model.repo import RepoModel
from rhodecode.tests.models.common import _make_repo
from rhodecode.model.meta import Session
class TestSummaryController(TestController):
def test_index(self):
self.log_user()
ID = Repository.get_by_repo_name(HG_REPO).repo_id
response = self.app.get(url(controller='summary',
action='index',
repo_name=HG_REPO))
#repo type
response.mustcontain(
"""<img style="margin-bottom:2px" class="icon" """
"""title="Mercurial repository" alt="Mercurial repository" """
"""src="/images/icons/hgicon.png"/>"""
)
"""title="public repository" alt="public """
"""repository" src="/images/icons/lock_open.png"/>"""
#codes stats
@@ -61,44 +64,58 @@ class TestSummaryController(TestControll
# clone url...
response.mustcontain("""<input style="width:80%%;margin-left:105px" type="text" id="clone_url" readonly="readonly" value="http://test_admin@localhost:80/%s"/>""" % GIT_REPO)
response.mustcontain("""<input style="display:none;width:80%%;margin-left:105px" type="text" id="clone_url_id" readonly="readonly" value="http://test_admin@localhost:80/_%s"/>""" % ID)
def test_index_by_id_hg(self):
repo_name='_%s' % ID))
response.mustcontain("""<img style="margin-bottom:2px" class="icon" """
"""title="Mercurial repository" alt="Mercurial """
"""repository" src="/images/icons/hgicon.png"/>""")
"""repository" src="/images/icons/lock_open.png"/>""")
def test_index_by_repo_having_id_path_in_name_hg(self):
_make_repo(name='repo_1')
Session().commit()
repo_name='repo_1'))
response.mustcontain("""repo_1""")
finally:
RepoModel().delete(Repository.get_by_repo_name('repo_1'))
def test_index_by_id_git(self):
ID = Repository.get_by_repo_name(GIT_REPO).repo_id
"""title="Git repository" alt="Git """
"""repository" src="/images/icons/giticon.png"/>""")
def _enable_stats(self):
r = Repository.get_by_repo_name(HG_REPO)
r.enable_statistics = True
self.Session.add(r)
self.Session.commit()
Status change: