##// END OF EJS Templates
fixed issue with displaying repos in groups view (without lightweight dashboard), added tests for this case
marcink -
r3167:87258a13 beta
parent child Browse files
Show More
@@ -295,7 +295,7 b' class ReposGroupsController(BaseControll'
295 c.groups = self.scm_model.get_repos_groups(groups)
295 c.groups = self.scm_model.get_repos_groups(groups)
296
296
297 if c.visual.lightweight_dashboard is False:
297 if c.visual.lightweight_dashboard is False:
298 c.repo_list = self.scm_model.get_repos(all_repos=gr_filter)
298 c.repos_list = self.scm_model.get_repos(all_repos=gr_filter)
299 ## lightweight version of dashboard
299 ## lightweight version of dashboard
300 else:
300 else:
301 c.repos_list = Repository.query()\
301 c.repos_list = Repository.query()\
@@ -303,10 +303,10 b' class ReposGroupsController(BaseControll'
303 .order_by(func.lower(Repository.repo_name))\
303 .order_by(func.lower(Repository.repo_name))\
304 .all()
304 .all()
305
305
306 repos_data = RepoModel().get_repos_as_dict(repos_list=c.repos_list,
306 repos_data = RepoModel().get_repos_as_dict(repos_list=c.repos_list,
307 admin=False)
307 admin=False)
308 #json used to render the grid
308 #json used to render the grid
309 c.data = json.dumps(repos_data)
309 c.data = json.dumps(repos_data)
310
310
311 return render('admin/repos_groups/repos_groups.html')
311 return render('admin/repos_groups/repos_groups.html')
312
312
@@ -3,6 +3,9 b' from rhodecode.tests import *'
3 from rhodecode.model.meta import Session
3 from rhodecode.model.meta import Session
4 from rhodecode.model.db import User, RhodeCodeSetting, Repository
4 from rhodecode.model.db import User, RhodeCodeSetting, Repository
5 from rhodecode.lib.utils import set_rhodecode_config
5 from rhodecode.lib.utils import set_rhodecode_config
6 from rhodecode.tests.models.common import _make_repo, _make_group
7 from rhodecode.model.repo import RepoModel
8 from rhodecode.model.repos_group import ReposGroupModel
6
9
7
10
8 class TestHomeController(TestController):
11 class TestHomeController(TestController):
@@ -61,18 +64,46 b' merge" class="tooltip" href="/vcs_test_h'
61 Session().add(anon)
64 Session().add(anon)
62 Session().commit()
65 Session().commit()
63
66
67 def _set_l_dash(self, set_to):
68 self.app.post(url('admin_setting', setting_id='visual'),
69 params=dict(_method='put',
70 rhodecode_lightweight_dashboard=set_to,))
71
64 def test_index_with_lightweight_dashboard(self):
72 def test_index_with_lightweight_dashboard(self):
65 self.log_user()
73 self.log_user()
66
74 self._set_l_dash(True)
67 def set_l_dash(set_to):
68 self.app.post(url('admin_setting', setting_id='visual'),
69 params=dict(_method='put',
70 rhodecode_lightweight_dashboard=set_to,))
71
72 set_l_dash(True)
73
75
74 try:
76 try:
75 response = self.app.get(url(controller='home', action='index'))
77 response = self.app.get(url(controller='home', action='index'))
76 response.mustcontain("""var data = {"totalRecords": %s""" % len(Repository.getAll()))
78 response.mustcontain("""var data = {"totalRecords": %s""" % len(Repository.getAll()))
77 finally:
79 finally:
78 set_l_dash(False)
80 self._set_l_dash(False)
81
82 def test_index_page_on_groups(self):
83 self.log_user()
84 _make_repo(name='gr1/repo_in_group', repos_group=_make_group('gr1'))
85 Session().commit()
86 response = self.app.get(url('repos_group_home', group_name='gr1'))
87
88 try:
89 response.mustcontain("""gr1/repo_in_group""")
90 finally:
91 RepoModel().delete('gr1/repo_in_group')
92 ReposGroupModel().delete(repos_group='gr1', force_delete=True)
93 Session().commit()
94
95 def test_index_page_on_groups_with_lightweight_dashboard(self):
96 self.log_user()
97 self._set_l_dash(True)
98 _make_repo(name='gr1/repo_in_group', repos_group=_make_group('gr1'))
99 Session().commit()
100 response = self.app.get(url('repos_group_home', group_name='gr1'))
101
102 try:
103 response.mustcontain("""gr1/repo_in_group""")
104 finally:
105 self._set_l_dash(False)
106 RepoModel().delete('gr1/repo_in_group')
107 ReposGroupModel().delete(repos_group='gr1', force_delete=True)
108 Session().commit()
109 No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now