Mercurial > kallithea
comparison rhodecode/tests/functional/test_home.py @ 2946:dbb311201ce3 beta
add test for enabling lightweight dashboard
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sat, 20 Oct 2012 16:50:00 +0200 |
parents | a2eaa0054430 |
children | 9937afa7f093 |
comparison
equal
deleted
inserted
replaced
2945:68e95f5ae3a7 | 2946:dbb311201ce3 |
---|---|
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 | 4 from rhodecode.model.db import User, RhodeCodeSetting, Repository |
5 from rhodecode.lib.utils import set_rhodecode_config | |
5 | 6 |
6 | 7 |
7 class TestHomeController(TestController): | 8 class TestHomeController(TestController): |
8 | 9 |
9 def test_index(self): | 10 def test_index(self): |
57 finally: | 58 finally: |
58 anon = User.get_by_username('default') | 59 anon = User.get_by_username('default') |
59 anon.active = True | 60 anon.active = True |
60 Session().add(anon) | 61 Session().add(anon) |
61 Session().commit() | 62 Session().commit() |
63 | |
64 def test_index_with_lightweight_dashboard(self): | |
65 self.log_user() | |
66 | |
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 | |
74 try: | |
75 response = self.app.get(url(controller='home', action='index')) | |
76 response.mustcontain("""var data = {"totalRecords": %s""" % len(Repository.getAll())) | |
77 finally: | |
78 set_l_dash(False) | |
79 |