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 44 insertions and 13 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/admin/repos_groups.py
Show inline comments
 
@@ -295,7 +295,7 @@ class ReposGroupsController(BaseControll
 
        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()\
 
@@ -303,10 +303,10 @@ class ReposGroupsController(BaseControll
 
                            .order_by(func.lower(Repository.repo_name))\
 
                            .all()
 

	
 
        repos_data = RepoModel().get_repos_as_dict(repos_list=c.repos_list,
 
                                                   admin=False)
 
        #json used to render the grid
 
        c.data = json.dumps(repos_data)
 
            repos_data = RepoModel().get_repos_as_dict(repos_list=c.repos_list,
 
                                                       admin=False)
 
            #json used to render the grid
 
            c.data = json.dumps(repos_data)
 

	
 
        return render('admin/repos_groups/repos_groups.html')
 

	
rhodecode/tests/functional/test_home.py
Show inline comments
 
@@ -3,6 +3,9 @@ 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):
 
@@ -61,18 +64,46 @@ merge" class="tooltip" href="/vcs_test_h
 
            Session().add(anon)
 
            Session().commit()
 

	
 
    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,))
 

	
 
    def test_index_with_lightweight_dashboard(self):
 
        self.log_user()
 

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

	
 
        set_l_dash(True)
 
        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()
 
            
 
\ No newline at end of file
0 comments (0 inline, 0 general)