Mercurial > kallithea
comparison rhodecode/tests/functional/test_admin_defaults.py @ 3056:6104dfd35b16 beta
Implemented #379 defaults settings page for creation of repositories
- locking
- statistics, downloads
- repository type
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Mon, 03 Dec 2012 02:55:08 +0100 |
parents | |
children | ffd45b185016 |
comparison
equal
deleted
inserted
replaced
3055:301268606429 | 3056:6104dfd35b16 |
---|---|
1 from rhodecode.tests import * | |
2 from rhodecode.model.db import RhodeCodeSetting | |
3 | |
4 | |
5 class TestDefaultsController(TestController): | |
6 | |
7 def test_index(self): | |
8 self.log_user() | |
9 response = self.app.get(url('defaults')) | |
10 response.mustcontain('default_repo_private') | |
11 response.mustcontain('default_repo_enable_statistics') | |
12 response.mustcontain('default_repo_enable_downloads') | |
13 response.mustcontain('default_repo_enable_locking') | |
14 | |
15 def test_index_as_xml(self): | |
16 response = self.app.get(url('formatted_defaults', format='xml')) | |
17 | |
18 def test_create(self): | |
19 response = self.app.post(url('defaults')) | |
20 | |
21 def test_new(self): | |
22 response = self.app.get(url('new_default')) | |
23 | |
24 def test_new_as_xml(self): | |
25 response = self.app.get(url('formatted_new_default', format='xml')) | |
26 | |
27 def test_update(self): | |
28 self.log_user() | |
29 params = { | |
30 'default_repo_enable_locking': True, | |
31 'default_repo_enable_downloads': True, | |
32 'default_repo_enable_statistics': True, | |
33 'default_repo_private': True, | |
34 'default_repo_type': 'hg', | |
35 } | |
36 response = self.app.put(url('default', id='default'), params=params) | |
37 self.checkSessionFlash(response, 'Default settings updated successfully') | |
38 defs = RhodeCodeSetting.get_default_repo_settings() | |
39 self.assertEqual(params, defs) | |
40 | |
41 params = { | |
42 'default_repo_enable_locking': False, | |
43 'default_repo_enable_downloads': False, | |
44 'default_repo_enable_statistics': False, | |
45 'default_repo_private': False, | |
46 'default_repo_type': 'git', | |
47 } | |
48 response = self.app.put(url('default', id='default'), params=params) | |
49 self.checkSessionFlash(response, 'Default settings updated successfully') | |
50 defs = RhodeCodeSetting.get_default_repo_settings() | |
51 self.assertEqual(params, defs) | |
52 | |
53 def test_update_browser_fakeout(self): | |
54 response = self.app.post(url('default', id=1), params=dict(_method='put')) | |
55 | |
56 def test_delete(self): | |
57 response = self.app.delete(url('default', id=1)) | |
58 | |
59 def test_delete_browser_fakeout(self): | |
60 response = self.app.post(url('default', id=1), params=dict(_method='delete')) | |
61 | |
62 def test_show(self): | |
63 response = self.app.get(url('default', id=1)) | |
64 | |
65 def test_show_as_xml(self): | |
66 response = self.app.get(url('formatted_default', id=1, format='xml')) | |
67 | |
68 def test_edit(self): | |
69 response = self.app.get(url('edit_default', id=1)) | |
70 | |
71 def test_edit_as_xml(self): | |
72 response = self.app.get(url('formatted_edit_default', id=1, format='xml')) |