Showing 1 changed files with 123 additions and 149 deletions
+123 -149
xt/user.t
... ...
@@ -30,40 +30,36 @@ note 'Start page';
30 30
   $t->ua->max_redirects(3);
31 31
 
32 32
   # Redirect to _start page
33
-  $t->get_ok('/')->content_like(qr/Create Admin User/);
33
+  $t->get_ok('/');
34
+  $t->content_like(qr/Create Admin User/);
34 35
 
35 36
   # Page access
36
-  $t->get_ok('/_start')->content_like(qr/Create Admin User/);
37
+  $t->get_ok('/_start');
38
+  $t->content_like(qr/Create Admin User/);
37 39
   
38 40
   # Password is empty
39
-  $t->post_ok('/_start?op=create', form => {password => ''})
40
-    ->content_like(qr/Password is empty/)
41
-  ;
41
+  $t->post_ok('/_start?op=create', form => {password => ''});
42
+  $t->content_like(qr/Password is empty/);
42 43
   
43 44
   # Password contains invalid character
44
-  $t->post_ok('/_start?op=create', form => {password => "\t"})
45
-    ->content_like(qr/Password contains invalid character/)
46
-  ;
45
+  $t->post_ok('/_start?op=create', form => {password => "\t"});
46
+  $t->content_like(qr/Password contains invalid character/);
47 47
 
48 48
   # Password contains invalid character
49
-  $t->post_ok('/_start?op=create', form => {password => 'a' x 21})
50
-    ->content_like(qr/Password is too long/)
51
-  ;
49
+  $t->post_ok('/_start?op=create', form => {password => 'a' x 21});
50
+  $t->content_like(qr/Password is too long/);
52 51
 
53 52
   # Two password don't match
54
-  $t->post_ok('/_start?op=create', form => {password => 'a', password2 => 'b'})
55
-    ->content_like(qr/Two password/)
56
-  ;
53
+  $t->post_ok('/_start?op=create', form => {password => 'a', password2 => 'b'});
54
+  $t->content_like(qr/Two password/);
57 55
   
58 56
   # Create admin user
59
-  $t->post_ok('/_start?op=create', form => {password => 'a', password2 => 'a'})
60
-    ->content_like(qr/Login Page/);
61
-  ;
57
+  $t->post_ok('/_start?op=create', form => {password => 'a', password2 => 'a'});
58
+  $t->content_like(qr/Login Page/);
62 59
 
63 60
   # Admin user already exists
64
-  $t->post_ok('/_start?op=create', form => {password => 'a', password2 => 'a'})
65
-    ->content_like(qr/Admin user already exists/);
66
-  ;
61
+  $t->post_ok('/_start?op=create', form => {password => 'a', password2 => 'a'});
62
+  $t->content_like(qr/Admin user already exists/);
67 63
 }
68 64
 
69 65
 note 'Admin pages';
... ...
@@ -75,135 +71,128 @@ note 'Admin pages';
75 71
   $t->ua->max_redirects(3);
76 72
 
77 73
   # Create admin user
78
-  $t->post_ok('/_start?op=create', form => {password => 'a', password2 => 'a'})
79
-    ->content_like(qr/Login Page/);
80
-  ;
74
+  $t->post_ok('/_start?op=create', form => {password => 'a', password2 => 'a'});
75
+  $t->content_like(qr/Login Page/);
81 76
   
82 77
   # Page access
83
-  $t->get_ok('/_login')->content_like(qr/Login Page/);
78
+  $t->get_ok('/_login');
79
+  $t->content_like(qr/Login Page/);
84 80
   
85 81
   # Login fail
86
-  $t->post_ok('/_login?op=login', form => {id => 'admin', password => 'b'})
87
-    ->content_like(qr/User name or password is wrong/)
88
-  ;
82
+  $t->post_ok('/_login?op=login', form => {id => 'admin', password => 'b'});
83
+  $t->content_like(qr/User name or password is wrong/);
89 84
 
90 85
   # Login success
91
-  $t->post_ok('/_login?op=login', form => {id => 'admin', password => 'a'})
92
-    ->content_like(qr/Admin/)
93
-  ;
86
+  $t->post_ok('/_login?op=login', form => {id => 'admin', password => 'a'});
87
+  $t->content_like(qr/Admin/);
94 88
   
95 89
   note 'Admin page';
96 90
   {
97
-    $t->post_ok('/_admin')->content_like(qr/Admin/);
91
+    $t->post_ok('/_admin');
92
+    $t->content_like(qr/Admin/);
98 93
   }
99 94
   
100 95
   note 'Admin User page';
101 96
   {
102
-    $t->get_ok('/_admin/users')->content_like(qr/Admin Users/);
97
+    $t->get_ok('/_admin/users');
98
+    $t->content_like(qr/Admin Users/);
103 99
   }
104 100
 
105 101
   note 'Create User page';
106 102
   {
107 103
     # Page access
108
-    $t->get_ok('/_admin/user/create')->content_like(qr/Create User/);
104
+    $t->get_ok('/_admin/user/create');
105
+    $t->content_like(qr/Create User/);
109 106
     
110 107
     # User name is empty
111
-    $t->post_ok('/_admin/user/create?op=create', form => {id => ''})
112
-      ->content_like(qr/User name is empty/);
108
+    $t->post_ok('/_admin/user/create?op=create', form => {id => ''});
109
+    $t->content_like(qr/User name is empty/);
113 110
 
114 111
     # User name contain invalid character
115
-    $t->post_ok('/_admin/user/create?op=create', form => {id => '&'})
116
-      ->content_like(qr/User name contain invalid character/);
112
+    $t->post_ok('/_admin/user/create?op=create', form => {id => '&'});
113
+    $t->content_like(qr/User name contain invalid character/);
117 114
 
118 115
     # User name is too long
119
-    $t->post_ok('/_admin/user/create?op=create', form => {id => 'a' x 21})
120
-      ->content_like(qr/User name is too long/);
116
+    $t->post_ok('/_admin/user/create?op=create', form => {id => 'a' x 21});
117
+    $t->content_like(qr/User name is too long/);
121 118
 
122 119
     # Password is empty
123
-    $t->post_ok('/_admin/user/create?op=create', form => {id => 'a', password => ''})
124
-      ->content_like(qr/Password is empty/);
120
+    $t->post_ok('/_admin/user/create?op=create', form => {id => 'a', password => ''});
121
+    $t->content_like(qr/Password is empty/);
125 122
 
126 123
     # Password contain invalid character
127
-    $t->post_ok('/_admin/user/create?op=create', form => {id => 'a', password => "\t"})
128
-      ->content_like(qr/Password contain invalid character/);
124
+    $t->post_ok('/_admin/user/create?op=create', form => {id => 'a', password => "\t"});
125
+    $t->content_like(qr/Password contain invalid character/);
129 126
 
130 127
     # Password contain invalid character
131
-    $t->post_ok('/_admin/user/create?op=create', form => {id => 'a', password => 'a' x 21})
132
-      ->content_like(qr/Password is too long/);
128
+    $t->post_ok('/_admin/user/create?op=create', form => {id => 'a', password => 'a' x 21});
129
+    $t->content_like(qr/Password is too long/);
133 130
 
134 131
     # Password contain invalid character
135
-    $t->post_ok('/_admin/user/create?op=create', form => {id => 'a', password => 'a', password2 => 'b'})
136
-      ->content_like(qr/Two password/);
132
+    $t->post_ok('/_admin/user/create?op=create', form => {id => 'a', password => 'a', password2 => 'b'});
133
+    $t->content_like(qr/Two password/);
137 134
     
138 135
     # Create user
139
-    $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto', password => 'a', password2 => 'a'})
140
-      ->content_like(qr/Success.*created/);
136
+    $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto', password => 'a', password2 => 'a'});
137
+    $t->content_like(qr/Success.*created/);
141 138
   }
142 139
     
143 140
   note 'Admin Users page';
144
-  $t->get_ok('/_admin/users')
145
-    ->content_like(qr/Admin Users/)
146
-    ->content_like(qr/kimoto/);
141
+  $t->get_ok('/_admin/users');
142
+  $t->content_like(qr/Admin Users/);
143
+  $t->content_like(qr/kimoto/);
147 144
   
148 145
   note 'Reset password page';
149 146
   {
150 147
     # Page access
151
-    $t->get_ok('/reset-password?user=kimoto')
152
-      ->content_like(qr/Reset Password/)
153
-      ->content_like(qr/kimoto/)
154
-    ;
148
+    $t->get_ok('/reset-password?user=kimoto');
149
+    $t->content_like(qr/Reset Password/);
150
+    $t->content_like(qr/kimoto/);
155 151
     
156 152
     # Password is empty
157
-    $t->post_ok('/reset-password?user=kimoto&op=reset', form => {password => ''})
158
-      ->content_like(qr/Password is empty/)
159
-    ;
153
+    $t->post_ok('/reset-password?user=kimoto&op=reset', form => {password => ''});
154
+    $t->content_like(qr/Password is empty/);
160 155
 
161 156
     # Password contains invalid character
162
-    $t->post_ok('/reset-password?user=kimoto&op=reset', form => {password => "\t"})
163
-      ->content_like(qr/Password contains invalid character/)
164
-    ;
157
+    $t->post_ok('/reset-password?user=kimoto&op=reset', form => {password => "\t"});
158
+    $t->content_like(qr/Password contains invalid character/);
165 159
 
166 160
     # Password is too long
167
-    $t->post_ok('/reset-password?user=kimoto&op=reset', form => {password => 'a' x 21})
168
-      ->content_like(qr/Password is too long/)
169
-    ;
161
+    $t->post_ok('/reset-password?user=kimoto&op=reset', form => {password => 'a' x 21});
162
+    $t->content_like(qr/Password is too long/);
170 163
     
171 164
     # Two password don't match
172
-    $t->post_ok('/reset-password?user=kimoto&op=reset', form => {password => 'a', password2 => 'b'})
173
-      ->content_like(qr/Two password/)
174
-    ;
165
+    $t->post_ok('/reset-password?user=kimoto&op=reset', form => {password => 'a', password2 => 'b'});
166
+    $t->content_like(qr/Two password/);
175 167
 
176 168
     # Reset password
177
-    $t->post_ok('/reset-password?user=kimoto&op=reset', form => {password => 'a', password2 => 'a'})
178
-      ->content_like(qr/Success.*changed/)
179
-    ;
169
+    $t->post_ok('/reset-password?user=kimoto&op=reset', form => {password => 'a', password2 => 'a'});
170
+    $t->content_like(qr/Success.*changed/);
180 171
   }
181 172
 
182 173
   note 'Delete user';
183 174
   {
184 175
     # Create user
185
-    $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto-tmp', password => 'a', password2 => 'a'})
186
-      ->content_like(qr/kimoto-tmp/);
187
-    $t->get_ok('/_admin/users')
188
-      ->content_like(qr/kimoto-tmp/);
176
+    $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto-tmp', password => 'a', password2 => 'a'});
177
+    $t->content_like(qr/kimoto-tmp/);
178
+    $t->get_ok('/_admin/users');
179
+    $t->content_like(qr/kimoto-tmp/);
189 180
 
190 181
     # User not exists
191
-    $t->post_ok('/_admin/users?op=delete', form => {user => 'kimoto-notting'})
192
-      ->content_like(qr/Internal/);
182
+    $t->post_ok('/_admin/users?op=delete', form => {user => 'kimoto-notting'});
183
+    $t->content_like(qr/Internal/);
193 184
 
194 185
     # User not exists
195
-    $t->post_ok('/_admin/users?op=delete', form => {user => 'kimoto-tmp'})
196
-      ->content_like(qr/User.*deleted/);
197
-    $t->get_ok('/_admin/users')
198
-      ->content_unlike(qr/kimoto-tmp/);
199
-
200
-    ;
186
+    $t->post_ok('/_admin/users?op=delete', form => {user => 'kimoto-tmp'});
187
+    $t->content_like(qr/User.*deleted/);
188
+    $t->get_ok('/_admin/users');
189
+    $t->content_unlike(qr/kimoto-tmp/);
201 190
   }
202 191
   
203 192
   note 'logout';
204
-  $t->get_ok('/_logout')
205
-    ->get_ok('/_admin')
206
-    ->content_like(qr/Users/);
193
+  $t->get_ok('/_logout');
194
+  $t->get_ok('/_admin');
195
+  $t->content_like(qr/Users/);
207 196
 }
208 197
 
209 198
 note 'Reset password';
... ...
@@ -215,33 +204,30 @@ note 'Reset password';
215 204
   $t->ua->max_redirects(3);
216 205
 
217 206
   # Create admin user
218
-  $t->post_ok('/_start?op=create', form => {password => 'a', password2 => 'a'})
219
-    ->content_like(qr/Login Page/);
220
-  ;
207
+  $t->post_ok('/_start?op=create', form => {password => 'a', password2 => 'a'});
208
+  $t->content_like(qr/Login Page/);;
221 209
 
222 210
   # Not loing user can't access
223
-  $t->get_ok('/reset-password')
224
-    ->content_like(qr/Users/);
211
+  $t->get_ok('/reset-password');
212
+  $t->content_like(qr/Users/);
225 213
 
226 214
   # Cnahge password(reset_password conf on)
227 215
   $app->config->{admin}{reset_password} = 1;
228
-  $t->get_ok('/reset-password')
229
-    ->content_like(qr/Reset Password/);
230
-  $t->post_ok('/reset-password?op=reset', form => {password => 'b', password2 => 'b'})
231
-    ->content_like(qr/Success.*changed/)
232
-  ;
216
+  $t->get_ok('/reset-password');
217
+  $t->content_like(qr/Reset Password/);
218
+  $t->post_ok('/reset-password?op=reset', form => {password => 'b', password2 => 'b'});
219
+  $t->content_like(qr/Success.*changed/);
233 220
   $app->config->{admin}{reset_password} = 0;
234 221
 
235 222
   # Login success
236
-  $t->post_ok('/_login?op=login', form => {id => 'admin', password => 'b'})
237
-    ->content_like(qr/Admin/)
238
-  ;
223
+  $t->post_ok('/_login?op=login', form => {id => 'admin', password => 'b'});
224
+  $t->content_like(qr/Admin/);
239 225
   
240 226
   # Create user
241
-  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto1', password => 'a', password2 => 'a'})
242
-    ->content_like(qr/kimoto1/);
243
-  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto2', password => 'a', password2 => 'a'})
244
-    ->content_like(qr/kimoto2/);
227
+  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto1', password => 'a', password2 => 'a'});
228
+  $t->content_like(qr/kimoto1/);
229
+  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto2', password => 'a', password2 => 'a'});
230
+  $t->content_like(qr/kimoto2/);
245 231
   
246 232
   # Logout
247 233
   $t->get_ok('/_logout');
... ...
@@ -251,17 +237,14 @@ note 'Reset password';
251 237
   $t->get_ok('/')->content_like(qr/kimoto1/);
252 238
 
253 239
   # Don't change other user password
254
-  $t->get_ok('/reset-password?user=kimoto2')
255
-    ->content_like(qr/Users/)
256
-  ;
257
-  $t->post_ok('/reset-password?user=kimoto2&op=reset', form => {password => 'b', password2 => 'b'})
258
-    ->content_like(qr/Users/)
259
-  ;
240
+  $t->get_ok('/reset-password?user=kimoto2');
241
+  $t->content_like(qr/Users/);
242
+  $t->post_ok('/reset-password?user=kimoto2&op=reset', form => {password => 'b', password2 => 'b'});
243
+  $t->content_like(qr/Users/);
260 244
 
261 245
   # Reset password
262
-  $t->get_ok('/reset-password?user=kimoto1')
263
-    ->content_like(qr/Reset Password/)
264
-  ;
246
+  $t->get_ok('/reset-password?user=kimoto1');
247
+  $t->content_like(qr/Reset Password/);
265 248
   $t->post_ok('/reset-password?user=kimoto1&op=reset', form => {password => 'b', password2 => 'b'});
266 249
   
267 250
   # Login as kimoto
... ...
@@ -280,70 +263,61 @@ note 'User Account Settings';
280 263
   $t->ua->max_redirects(3);
281 264
 
282 265
   # Create admin user
283
-  $t->post_ok('/_start?op=create', form => {password => 'a', password2 => 'a'})
284
-    ->content_like(qr/Login Page/);
285
-  ;
266
+  $t->post_ok('/_start?op=create', form => {password => 'a', password2 => 'a'});
267
+  $t->content_like(qr/Login Page/);
286 268
 
287 269
   # Login as admin
288 270
   $t->post_ok('/_login?op=login', form => {id => 'admin', password => 'a'});
289 271
 
290 272
   # Create user
291
-  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto1', password => 'a', password2 => 'a'})
292
-    ->content_like(qr/kimoto1/);
293
-  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto2', password => 'a', password2 => 'a'})
294
-    ->content_like(qr/kimoto2/);
273
+  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto1', password => 'a', password2 => 'a'});
274
+  $t->content_like(qr/kimoto1/);
275
+  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto2', password => 'a', password2 => 'a'});
276
+  $t->content_like(qr/kimoto2/);
295 277
   
296 278
   # Login as kimoto1
297 279
   $t->post_ok('/_login?op=login', form => {id => 'kimoto1', password => 'a'});
298 280
 
299 281
   # User account settings
300
-  $t->get_ok('/kimoto1/_settings')
301
-    ->content_like(qr/User Account Settings/)
302
-  ;
282
+  $t->get_ok('/kimoto1/_settings');
283
+  $t->content_like(qr/User Account Settings/);
303 284
   
304 285
   # Other user can't access
305
-  $t->get_ok('/kimoto2/_settings')
306
-    ->content_like(qr/Users/)
307
-  ;
286
+  $t->get_ok('/kimoto2/_settings');
287
+  $t->content_like(qr/Users/);
308 288
   
309 289
   note 'Create repository';
310 290
   {
311 291
     # Create repository page
312
-    $t->get_ok('/_new')
313
-      ->content_like(qr/Create repository/)
314
-    ;
292
+    $t->get_ok('/_new');
293
+    $t->content_like(qr/Create repository/);
315 294
     
316 295
     # Not logined user can't access
317 296
     $t->get_ok('/_logout');
318
-    $t->get_ok('/_new')
319
-      ->content_like(qr/Users/)
320
-    ;
297
+    $t->get_ok('/_new');
298
+    $t->content_like(qr/Users/);
321 299
     $t->post_ok('/_login?op=login', form => {id => 'kimoto1', password => 'a'});
322 300
     
323 301
     # Create repository
324
-    $t->post_ok('/_new?op=create', form => {project => 't1', description => 'Hello'})
325
-      ->content_like(qr/Create a new repository on the command line/)
326
-      ->content_like(qr/t1\.git/)
327
-      ->content_like(qr/Hello/)
328
-    ;
302
+    $t->post_ok('/_new?op=create', form => {project => 't1', description => 'Hello'});
303
+    $t->content_like(qr/Create a new repository on the command line/);
304
+    $t->content_like(qr/t1\.git/);
305
+    $t->content_like(qr/Hello/);
329 306
 
330 307
     # Create repository(with readme)
331
-    $t->post_ok('/_new?op=create', form => {project => 't2', description => 'Hello', readme => 1})
332
-      ->content_like(qr/first commit/)
333
-      ->content_like(qr/t2\.git/)
334
-      ->content_like(qr/README/)
335
-    ;
308
+    $t->post_ok('/_new?op=create', form => {project => 't2', description => 'Hello', readme => 1});
309
+    $t->content_like(qr/first commit/);
310
+    $t->content_like(qr/t2\.git/);
311
+    $t->content_like(qr/README/);
336 312
     
337 313
     # Settings page(don't has README)
338
-    $t->get_ok('/kimoto1/t1/settings')
339
-      ->content_like(qr/Settings/)
340
-    ;
314
+    $t->get_ok('/kimoto1/t1/settings');
315
+    $t->content_like(qr/Settings/);
341 316
     
342 317
     # Settings page(has README)
343
-    $t->get_ok('/kimoto1/t2/settings')
344
-      ->content_like(qr/Settings/)
345
-    ;
318
+    $t->get_ok('/kimoto1/t2/settings');
319
+    $t->content_like(qr/Settings/);
346 320
   }
321
+  
322
+  note 'Project settings';
347 323
 }
348
-
349
-