Mercurial > kallithea
comparison rhodecode/tests/functional/test_home.py @ 3167:87258a137018 beta
fixed issue with displaying repos in groups view (without lightweight dashboard), added tests for this case
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 18 Jan 2013 01:01:22 +0100 |
parents | 9937afa7f093 |
children | 2fb94c52e20e |
comparison
equal
deleted
inserted
replaced
3166:abd49f6f5805 | 3167:87258a137018 |
---|---|
1 import time | 1 import time |
2 from rhodecode.tests import * | 2 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): |
9 | 12 |
10 def test_index(self): | 13 def test_index(self): |
59 anon = User.get_by_username('default') | 62 anon = User.get_by_username('default') |
60 anon.active = True | 63 anon.active = True |
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 |