Changeset - 87258a137018
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 13 years ago 2013-01-18 01:01:22
marcin@python-works.com
fixed issue with displaying repos in groups view (without lightweight dashboard), added tests for this case
2 files changed with 37 insertions and 7 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/admin/repos_groups.py
Show inline comments
 
@@ -292,13 +292,13 @@ class ReposGroupsController(BaseControll
 

	
 
        groups = RepoGroup.query().order_by(RepoGroup.group_name)\
 
            .filter(RepoGroup.group_parent_id == id).all()
 
        c.groups = self.scm_model.get_repos_groups(groups)
 

	
 
        if c.visual.lightweight_dashboard is False:
 
            c.repo_list = self.scm_model.get_repos(all_repos=gr_filter)
 
            c.repos_list = self.scm_model.get_repos(all_repos=gr_filter)
 
        ## lightweight version of dashboard
 
        else:
 
            c.repos_list = Repository.query()\
 
                            .filter(Repository.group_id == id)\
 
                            .order_by(func.lower(Repository.repo_name))\
 
                            .all()
rhodecode/tests/functional/test_home.py
Show inline comments
 
import time
 
from rhodecode.tests import *
 
from rhodecode.model.meta import Session
 
from rhodecode.model.db import User, RhodeCodeSetting, Repository
 
from rhodecode.lib.utils import set_rhodecode_config
 
from rhodecode.tests.models.common import _make_repo, _make_group
 
from rhodecode.model.repo import RepoModel
 
from rhodecode.model.repos_group import ReposGroupModel
 

	
 

	
 
class TestHomeController(TestController):
 

	
 
    def test_index(self):
 
        self.log_user()
 
@@ -58,21 +61,48 @@ merge" class="tooltip" href="/vcs_test_h
 
        finally:
 
            anon = User.get_by_username('default')
 
            anon.active = True
 
            Session().add(anon)
 
            Session().commit()
 

	
 
    def test_index_with_lightweight_dashboard(self):
 
        self.log_user()
 

	
 
        def set_l_dash(set_to):
 
    def _set_l_dash(self, set_to):
 
            self.app.post(url('admin_setting', setting_id='visual'),
 
                          params=dict(_method='put',
 
                                      rhodecode_lightweight_dashboard=set_to,))
 

	
 
        set_l_dash(True)
 
    def test_index_with_lightweight_dashboard(self):
 
        self.log_user()
 
        self._set_l_dash(True)
 

	
 
        try:
 
            response = self.app.get(url(controller='home', action='index'))
 
            response.mustcontain("""var data = {"totalRecords": %s""" % len(Repository.getAll()))
 
        finally:
 
            set_l_dash(False)
 
            self._set_l_dash(False)
 

	
 
    def test_index_page_on_groups(self):
 
        self.log_user()
 
        _make_repo(name='gr1/repo_in_group', repos_group=_make_group('gr1'))
 
        Session().commit()
 
        response = self.app.get(url('repos_group_home', group_name='gr1'))
 

	
 
        try:
 
            response.mustcontain("""gr1/repo_in_group""")
 
        finally:
 
            RepoModel().delete('gr1/repo_in_group')
 
            ReposGroupModel().delete(repos_group='gr1', force_delete=True)
 
            Session().commit()
 

	
 
    def test_index_page_on_groups_with_lightweight_dashboard(self):
 
        self.log_user()
 
        self._set_l_dash(True)
 
        _make_repo(name='gr1/repo_in_group', repos_group=_make_group('gr1'))
 
        Session().commit()
 
        response = self.app.get(url('repos_group_home', group_name='gr1'))
 

	
 
        try:
 
            response.mustcontain("""gr1/repo_in_group""")
 
        finally:
 
            self._set_l_dash(False)
 
            RepoModel().delete('gr1/repo_in_group')
 
            ReposGroupModel().delete(repos_group='gr1', force_delete=True)
 
            Session().commit()
0 comments (0 inline, 0 general)