Show More
@@ -9,6 +9,79 b' fixture = Fixture()' | |||||
9 |
|
9 | |||
10 | class TestRepoGroupsController(base.TestController): |
|
10 | class TestRepoGroupsController(base.TestController): | |
11 |
|
11 | |||
|
12 | def test_index(self): | |||
|
13 | self.log_user() | |||
|
14 | response = self.app.get(base.url('repos_groups')) | |||
|
15 | response.mustcontain('"records": []') | |||
|
16 | ||||
|
17 | def test_new(self): | |||
|
18 | self.log_user() | |||
|
19 | response = self.app.get(base.url('new_repos_group')) | |||
|
20 | ||||
|
21 | def test_create(self): | |||
|
22 | self.log_user() | |||
|
23 | ||||
|
24 | group_name = 'foo' | |||
|
25 | ||||
|
26 | # creation with form error | |||
|
27 | response = self.app.post(base.url('repos_groups'), | |||
|
28 | {'group_name': group_name, | |||
|
29 | '_session_csrf_secret_token': self.session_csrf_secret_token()}) | |||
|
30 | response.mustcontain('name="group_name" type="text" value="%s"' % group_name) | |||
|
31 | response.mustcontain('<!-- for: group_description -->') | |||
|
32 | ||||
|
33 | # creation | |||
|
34 | response = self.app.post(base.url('repos_groups'), | |||
|
35 | {'group_name': group_name, | |||
|
36 | 'group_description': 'lala', | |||
|
37 | 'parent_group_id': '-1', | |||
|
38 | 'group_copy_permissions': 'True', | |||
|
39 | '_session_csrf_secret_token': self.session_csrf_secret_token()}) | |||
|
40 | self.checkSessionFlash(response, 'Created repository group %s' % group_name) | |||
|
41 | ||||
|
42 | # edit form | |||
|
43 | response = self.app.get(base.url('edit_repo_group', group_name=group_name)) | |||
|
44 | response.mustcontain('>lala<') | |||
|
45 | ||||
|
46 | # edit with form error | |||
|
47 | response = self.app.post(base.url('update_repos_group', group_name=group_name), | |||
|
48 | {'group_name': group_name, | |||
|
49 | '_session_csrf_secret_token': self.session_csrf_secret_token()}) | |||
|
50 | response.mustcontain('name="group_name" type="text" value="%s"' % group_name) | |||
|
51 | response.mustcontain('<!-- for: group_description -->') | |||
|
52 | ||||
|
53 | # edit | |||
|
54 | response = self.app.post(base.url('update_repos_group', group_name=group_name), | |||
|
55 | {'group_name': group_name, | |||
|
56 | 'group_description': 'lolo', | |||
|
57 | '_session_csrf_secret_token': self.session_csrf_secret_token()}) | |||
|
58 | self.checkSessionFlash(response, 'Updated repository group %s' % group_name) | |||
|
59 | response = response.follow() | |||
|
60 | response.mustcontain('name="group_name" type="text" value="%s"' % group_name) | |||
|
61 | response.mustcontain(no='<!-- for: group_description -->') | |||
|
62 | response.mustcontain('>lolo<') | |||
|
63 | ||||
|
64 | # listing | |||
|
65 | response = self.app.get(base.url('repos_groups')) | |||
|
66 | response.mustcontain('raw_name": "%s"' % group_name) | |||
|
67 | ||||
|
68 | # show | |||
|
69 | response = self.app.get(base.url('repos_group', group_name=group_name)) | |||
|
70 | response.mustcontain('href="/_admin/repo_groups/%s/edit"' % group_name) | |||
|
71 | ||||
|
72 | # show ignores extra trailing slashes in the URL | |||
|
73 | response = self.app.get(base.url('repos_group', group_name='%s//' % group_name)) | |||
|
74 | response.mustcontain('href="/_admin/repo_groups/%s/edit"' % group_name) | |||
|
75 | ||||
|
76 | # delete | |||
|
77 | response = self.app.post(base.url('delete_repo_group', group_name=group_name), | |||
|
78 | {'_session_csrf_secret_token': self.session_csrf_secret_token()}) | |||
|
79 | self.checkSessionFlash(response, 'Removed repository group %s' % group_name) | |||
|
80 | ||||
|
81 | def test_new_by_regular_user(self): | |||
|
82 | self.log_user(base.TEST_USER_REGULAR_LOGIN, base.TEST_USER_REGULAR_PASS) | |||
|
83 | response = self.app.get(base.url('new_repos_group'), status=403) | |||
|
84 | ||||
12 | def test_case_insensitivity(self): |
|
85 | def test_case_insensitivity(self): | |
13 | self.log_user() |
|
86 | self.log_user() | |
14 | group_name = 'newgroup' |
|
87 | group_name = 'newgroup' |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now