@@ -0,0 +1,203 | |||||
|
1 | # Redmine - project management software | |||
|
2 | # Copyright (C) 2006-2011 Jean-Philippe Lang | |||
|
3 | # | |||
|
4 | # This program is free software; you can redistribute it and/or | |||
|
5 | # modify it under the terms of the GNU General Public License | |||
|
6 | # as published by the Free Software Foundation; either version 2 | |||
|
7 | # of the License, or (at your option) any later version. | |||
|
8 | # | |||
|
9 | # This program is distributed in the hope that it will be useful, | |||
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
12 | # GNU General Public License for more details. | |||
|
13 | # | |||
|
14 | # You should have received a copy of the GNU General Public License | |||
|
15 | # along with this program; if not, write to the Free Software | |||
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
|
17 | ||||
|
18 | require File.expand_path('../../../test_helper', __FILE__) | |||
|
19 | ||||
|
20 | class RoutingTimelogsTest < ActionController::IntegrationTest | |||
|
21 | def test_timelogs_global | |||
|
22 | assert_routing( | |||
|
23 | { :method => 'get', :path => "/time_entries" }, | |||
|
24 | { :controller => 'timelog', :action => 'index' } | |||
|
25 | ) | |||
|
26 | assert_routing( | |||
|
27 | { :method => 'get', :path => "/time_entries.csv" }, | |||
|
28 | { :controller => 'timelog', :action => 'index', :format => 'csv' } | |||
|
29 | ) | |||
|
30 | assert_routing( | |||
|
31 | { :method => 'get', :path => "/time_entries.atom" }, | |||
|
32 | { :controller => 'timelog', :action => 'index', :format => 'atom' } | |||
|
33 | ) | |||
|
34 | assert_routing( | |||
|
35 | { :method => 'get', :path => "/time_entries/new" }, | |||
|
36 | { :controller => 'timelog', :action => 'new' } | |||
|
37 | ) | |||
|
38 | assert_routing( | |||
|
39 | { :method => 'get', :path => "/time_entries/22/edit" }, | |||
|
40 | { :controller => 'timelog', :action => 'edit', :id => '22' } | |||
|
41 | ) | |||
|
42 | assert_routing( | |||
|
43 | { :method => 'post', :path => "/time_entries" }, | |||
|
44 | { :controller => 'timelog', :action => 'create' } | |||
|
45 | ) | |||
|
46 | assert_routing( | |||
|
47 | { :method => 'put', :path => "/time_entries/22" }, | |||
|
48 | { :controller => 'timelog', :action => 'update', :id => '22' } | |||
|
49 | ) | |||
|
50 | assert_routing( | |||
|
51 | { :method => 'delete', :path => "/time_entries/55" }, | |||
|
52 | { :controller => 'timelog', :action => 'destroy', :id => '55' } | |||
|
53 | ) | |||
|
54 | end | |||
|
55 | ||||
|
56 | def test_timelogs_scoped_under_project | |||
|
57 | assert_routing( | |||
|
58 | { :method => 'get', :path => "/projects/567/time_entries" }, | |||
|
59 | { :controller => 'timelog', :action => 'index', :project_id => '567' } | |||
|
60 | ) | |||
|
61 | assert_routing( | |||
|
62 | { :method => 'get', :path => "/projects/567/time_entries.csv" }, | |||
|
63 | { :controller => 'timelog', :action => 'index', :project_id => '567', | |||
|
64 | :format => 'csv' } | |||
|
65 | ) | |||
|
66 | assert_routing( | |||
|
67 | { :method => 'get', :path => "/projects/567/time_entries.atom" }, | |||
|
68 | { :controller => 'timelog', :action => 'index', :project_id => '567', | |||
|
69 | :format => 'atom' } | |||
|
70 | ) | |||
|
71 | assert_routing( | |||
|
72 | { :method => 'get', :path => "/projects/567/time_entries/new" }, | |||
|
73 | { :controller => 'timelog', :action => 'new', :project_id => '567' } | |||
|
74 | ) | |||
|
75 | assert_routing( | |||
|
76 | { :method => 'get', :path => "/projects/567/time_entries/22/edit" }, | |||
|
77 | { :controller => 'timelog', :action => 'edit', | |||
|
78 | :id => '22', :project_id => '567' } | |||
|
79 | ) | |||
|
80 | assert_routing( | |||
|
81 | { :method => 'post', :path => "/projects/567/time_entries" }, | |||
|
82 | { :controller => 'timelog', :action => 'create', | |||
|
83 | :project_id => '567' } | |||
|
84 | ) | |||
|
85 | assert_routing( | |||
|
86 | { :method => 'put', :path => "/projects/567/time_entries/22" }, | |||
|
87 | { :controller => 'timelog', :action => 'update', | |||
|
88 | :id => '22', :project_id => '567' } | |||
|
89 | ) | |||
|
90 | assert_routing( | |||
|
91 | { :method => 'delete', :path => "/projects/567/time_entries/55" }, | |||
|
92 | { :controller => 'timelog', :action => 'destroy', | |||
|
93 | :id => '55', :project_id => '567' } | |||
|
94 | ) | |||
|
95 | end | |||
|
96 | ||||
|
97 | def test_timelogs_scoped_under_issues | |||
|
98 | assert_routing( | |||
|
99 | { :method => 'get', :path => "/issues/234/time_entries" }, | |||
|
100 | { :controller => 'timelog', :action => 'index', :issue_id => '234' } | |||
|
101 | ) | |||
|
102 | assert_routing( | |||
|
103 | { :method => 'get', :path => "/issues/234/time_entries.csv" }, | |||
|
104 | { :controller => 'timelog', :action => 'index', :issue_id => '234', | |||
|
105 | :format => 'csv' } | |||
|
106 | ) | |||
|
107 | assert_routing( | |||
|
108 | { :method => 'get', :path => "/issues/234/time_entries.atom" }, | |||
|
109 | { :controller => 'timelog', :action => 'index', :issue_id => '234', | |||
|
110 | :format => 'atom' } | |||
|
111 | ) | |||
|
112 | assert_routing( | |||
|
113 | { :method => 'get', :path => "/issues/234/time_entries/new" }, | |||
|
114 | { :controller => 'timelog', :action => 'new', :issue_id => '234' } | |||
|
115 | ) | |||
|
116 | assert_routing( | |||
|
117 | { :method => 'get', :path => "/issues/234/time_entries/22/edit" }, | |||
|
118 | { :controller => 'timelog', :action => 'edit', :id => '22', | |||
|
119 | :issue_id => '234' } | |||
|
120 | ) | |||
|
121 | assert_routing( | |||
|
122 | { :method => 'post', :path => "/issues/234/time_entries" }, | |||
|
123 | { :controller => 'timelog', :action => 'create', :issue_id => '234' } | |||
|
124 | ) | |||
|
125 | assert_routing( | |||
|
126 | { :method => 'put', :path => "/issues/234/time_entries/22" }, | |||
|
127 | { :controller => 'timelog', :action => 'update', :id => '22', | |||
|
128 | :issue_id => '234' } | |||
|
129 | ) | |||
|
130 | assert_routing( | |||
|
131 | { :method => 'delete', :path => "/issues/234/time_entries/55" }, | |||
|
132 | { :controller => 'timelog', :action => 'destroy', :id => '55', | |||
|
133 | :issue_id => '234' } | |||
|
134 | ) | |||
|
135 | end | |||
|
136 | ||||
|
137 | def test_timelogs_scoped_under_project_and_issues | |||
|
138 | assert_routing( | |||
|
139 | { :method => 'get', | |||
|
140 | :path => "/projects/ecookbook/issues/234/time_entries" }, | |||
|
141 | { :controller => 'timelog', :action => 'index', | |||
|
142 | :issue_id => '234', :project_id => 'ecookbook' } | |||
|
143 | ) | |||
|
144 | assert_routing( | |||
|
145 | { :method => 'get', | |||
|
146 | :path => "/projects/ecookbook/issues/234/time_entries.csv" }, | |||
|
147 | { :controller => 'timelog', :action => 'index', | |||
|
148 | :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' } | |||
|
149 | ) | |||
|
150 | assert_routing( | |||
|
151 | { :method => 'get', | |||
|
152 | :path => "/projects/ecookbook/issues/234/time_entries.atom" }, | |||
|
153 | { :controller => 'timelog', :action => 'index', | |||
|
154 | :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' } | |||
|
155 | ) | |||
|
156 | assert_routing( | |||
|
157 | { :method => 'get', | |||
|
158 | :path => "/projects/ecookbook/issues/234/time_entries/new" }, | |||
|
159 | { :controller => 'timelog', :action => 'new', | |||
|
160 | :issue_id => '234', :project_id => 'ecookbook' } | |||
|
161 | ) | |||
|
162 | assert_routing( | |||
|
163 | { :method => 'get', | |||
|
164 | :path => "/projects/ecookbook/issues/234/time_entries/22/edit" }, | |||
|
165 | { :controller => 'timelog', :action => 'edit', :id => '22', | |||
|
166 | :issue_id => '234', :project_id => 'ecookbook' } | |||
|
167 | ) | |||
|
168 | assert_routing( | |||
|
169 | { :method => 'post', | |||
|
170 | :path => "/projects/ecookbook/issues/234/time_entries" }, | |||
|
171 | { :controller => 'timelog', :action => 'create', | |||
|
172 | :issue_id => '234', :project_id => 'ecookbook' } | |||
|
173 | ) | |||
|
174 | assert_routing( | |||
|
175 | { :method => 'put', | |||
|
176 | :path => "/projects/ecookbook/issues/234/time_entries/22" }, | |||
|
177 | { :controller => 'timelog', :action => 'update', :id => '22', | |||
|
178 | :issue_id => '234', :project_id => 'ecookbook' } | |||
|
179 | ) | |||
|
180 | assert_routing( | |||
|
181 | { :method => 'delete', | |||
|
182 | :path => "/projects/ecookbook/issues/234/time_entries/55" }, | |||
|
183 | { :controller => 'timelog', :action => 'destroy', :id => '55', | |||
|
184 | :issue_id => '234', :project_id => 'ecookbook' } | |||
|
185 | ) | |||
|
186 | assert_routing( | |||
|
187 | { :method => 'get', | |||
|
188 | :path => "/time_entries/report" }, | |||
|
189 | { :controller => 'timelog', :action => 'report' } | |||
|
190 | ) | |||
|
191 | assert_routing( | |||
|
192 | { :method => 'get', | |||
|
193 | :path => "/projects/567/time_entries/report" }, | |||
|
194 | { :controller => 'timelog', :action => 'report', :project_id => '567' } | |||
|
195 | ) | |||
|
196 | assert_routing( | |||
|
197 | { :method => 'get', | |||
|
198 | :path => "/projects/567/time_entries/report.csv" }, | |||
|
199 | { :controller => 'timelog', :action => 'report', :project_id => '567', | |||
|
200 | :format => 'csv' } | |||
|
201 | ) | |||
|
202 | end | |||
|
203 | end |
@@ -475,189 +475,6 class RoutingTest < ActionController::IntegrationTest | |||||
475 | ) |
|
475 | ) | |
476 | end |
|
476 | end | |
477 |
|
477 | |||
478 | def test_timelogs_global |
|
|||
479 | assert_routing( |
|
|||
480 | { :method => 'get', :path => "/time_entries" }, |
|
|||
481 | { :controller => 'timelog', :action => 'index' } |
|
|||
482 | ) |
|
|||
483 | assert_routing( |
|
|||
484 | { :method => 'get', :path => "/time_entries.csv" }, |
|
|||
485 | { :controller => 'timelog', :action => 'index', :format => 'csv' } |
|
|||
486 | ) |
|
|||
487 | assert_routing( |
|
|||
488 | { :method => 'get', :path => "/time_entries.atom" }, |
|
|||
489 | { :controller => 'timelog', :action => 'index', :format => 'atom' } |
|
|||
490 | ) |
|
|||
491 | assert_routing( |
|
|||
492 | { :method => 'get', :path => "/time_entries/new" }, |
|
|||
493 | { :controller => 'timelog', :action => 'new' } |
|
|||
494 | ) |
|
|||
495 | assert_routing( |
|
|||
496 | { :method => 'get', :path => "/time_entries/22/edit" }, |
|
|||
497 | { :controller => 'timelog', :action => 'edit', :id => '22' } |
|
|||
498 | ) |
|
|||
499 | assert_routing( |
|
|||
500 | { :method => 'post', :path => "/time_entries" }, |
|
|||
501 | { :controller => 'timelog', :action => 'create' } |
|
|||
502 | ) |
|
|||
503 | assert_routing( |
|
|||
504 | { :method => 'put', :path => "/time_entries/22" }, |
|
|||
505 | { :controller => 'timelog', :action => 'update', :id => '22' } |
|
|||
506 | ) |
|
|||
507 | assert_routing( |
|
|||
508 | { :method => 'delete', :path => "/time_entries/55" }, |
|
|||
509 | { :controller => 'timelog', :action => 'destroy', :id => '55' } |
|
|||
510 | ) |
|
|||
511 | end |
|
|||
512 |
|
||||
513 | def test_timelogs_scoped_under_project |
|
|||
514 | assert_routing( |
|
|||
515 | { :method => 'get', :path => "/projects/567/time_entries" }, |
|
|||
516 | { :controller => 'timelog', :action => 'index', :project_id => '567' } |
|
|||
517 | ) |
|
|||
518 | assert_routing( |
|
|||
519 | { :method => 'get', :path => "/projects/567/time_entries.csv" }, |
|
|||
520 | { :controller => 'timelog', :action => 'index', :project_id => '567', |
|
|||
521 | :format => 'csv' } |
|
|||
522 | ) |
|
|||
523 | assert_routing( |
|
|||
524 | { :method => 'get', :path => "/projects/567/time_entries.atom" }, |
|
|||
525 | { :controller => 'timelog', :action => 'index', :project_id => '567', |
|
|||
526 | :format => 'atom' } |
|
|||
527 | ) |
|
|||
528 | assert_routing( |
|
|||
529 | { :method => 'get', :path => "/projects/567/time_entries/new" }, |
|
|||
530 | { :controller => 'timelog', :action => 'new', :project_id => '567' } |
|
|||
531 | ) |
|
|||
532 | assert_routing( |
|
|||
533 | { :method => 'get', :path => "/projects/567/time_entries/22/edit" }, |
|
|||
534 | { :controller => 'timelog', :action => 'edit', |
|
|||
535 | :id => '22', :project_id => '567' } |
|
|||
536 | ) |
|
|||
537 | assert_routing( |
|
|||
538 | { :method => 'post', :path => "/projects/567/time_entries" }, |
|
|||
539 | { :controller => 'timelog', :action => 'create', |
|
|||
540 | :project_id => '567' } |
|
|||
541 | ) |
|
|||
542 | assert_routing( |
|
|||
543 | { :method => 'put', :path => "/projects/567/time_entries/22" }, |
|
|||
544 | { :controller => 'timelog', :action => 'update', |
|
|||
545 | :id => '22', :project_id => '567' } |
|
|||
546 | ) |
|
|||
547 | assert_routing( |
|
|||
548 | { :method => 'delete', :path => "/projects/567/time_entries/55" }, |
|
|||
549 | { :controller => 'timelog', :action => 'destroy', |
|
|||
550 | :id => '55', :project_id => '567' } |
|
|||
551 | ) |
|
|||
552 | end |
|
|||
553 |
|
||||
554 | def test_timelogs_scoped_under_issues |
|
|||
555 | assert_routing( |
|
|||
556 | { :method => 'get', :path => "/issues/234/time_entries" }, |
|
|||
557 | { :controller => 'timelog', :action => 'index', :issue_id => '234' } |
|
|||
558 | ) |
|
|||
559 | assert_routing( |
|
|||
560 | { :method => 'get', :path => "/issues/234/time_entries.csv" }, |
|
|||
561 | { :controller => 'timelog', :action => 'index', :issue_id => '234', |
|
|||
562 | :format => 'csv' } |
|
|||
563 | ) |
|
|||
564 | assert_routing( |
|
|||
565 | { :method => 'get', :path => "/issues/234/time_entries.atom" }, |
|
|||
566 | { :controller => 'timelog', :action => 'index', :issue_id => '234', |
|
|||
567 | :format => 'atom' } |
|
|||
568 | ) |
|
|||
569 | assert_routing( |
|
|||
570 | { :method => 'get', :path => "/issues/234/time_entries/new" }, |
|
|||
571 | { :controller => 'timelog', :action => 'new', :issue_id => '234' } |
|
|||
572 | ) |
|
|||
573 | assert_routing( |
|
|||
574 | { :method => 'get', :path => "/issues/234/time_entries/22/edit" }, |
|
|||
575 | { :controller => 'timelog', :action => 'edit', :id => '22', |
|
|||
576 | :issue_id => '234' } |
|
|||
577 | ) |
|
|||
578 | assert_routing( |
|
|||
579 | { :method => 'post', :path => "/issues/234/time_entries" }, |
|
|||
580 | { :controller => 'timelog', :action => 'create', :issue_id => '234' } |
|
|||
581 | ) |
|
|||
582 | assert_routing( |
|
|||
583 | { :method => 'put', :path => "/issues/234/time_entries/22" }, |
|
|||
584 | { :controller => 'timelog', :action => 'update', :id => '22', |
|
|||
585 | :issue_id => '234' } |
|
|||
586 | ) |
|
|||
587 | assert_routing( |
|
|||
588 | { :method => 'delete', :path => "/issues/234/time_entries/55" }, |
|
|||
589 | { :controller => 'timelog', :action => 'destroy', :id => '55', |
|
|||
590 | :issue_id => '234' } |
|
|||
591 | ) |
|
|||
592 | end |
|
|||
593 |
|
||||
594 | def test_timelogs_scoped_under_project_and_issues |
|
|||
595 | assert_routing( |
|
|||
596 | { :method => 'get', |
|
|||
597 | :path => "/projects/ecookbook/issues/234/time_entries" }, |
|
|||
598 | { :controller => 'timelog', :action => 'index', |
|
|||
599 | :issue_id => '234', :project_id => 'ecookbook' } |
|
|||
600 | ) |
|
|||
601 | assert_routing( |
|
|||
602 | { :method => 'get', |
|
|||
603 | :path => "/projects/ecookbook/issues/234/time_entries.csv" }, |
|
|||
604 | { :controller => 'timelog', :action => 'index', |
|
|||
605 | :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' } |
|
|||
606 | ) |
|
|||
607 | assert_routing( |
|
|||
608 | { :method => 'get', |
|
|||
609 | :path => "/projects/ecookbook/issues/234/time_entries.atom" }, |
|
|||
610 | { :controller => 'timelog', :action => 'index', |
|
|||
611 | :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' } |
|
|||
612 | ) |
|
|||
613 | assert_routing( |
|
|||
614 | { :method => 'get', |
|
|||
615 | :path => "/projects/ecookbook/issues/234/time_entries/new" }, |
|
|||
616 | { :controller => 'timelog', :action => 'new', |
|
|||
617 | :issue_id => '234', :project_id => 'ecookbook' } |
|
|||
618 | ) |
|
|||
619 | assert_routing( |
|
|||
620 | { :method => 'get', |
|
|||
621 | :path => "/projects/ecookbook/issues/234/time_entries/22/edit" }, |
|
|||
622 | { :controller => 'timelog', :action => 'edit', :id => '22', |
|
|||
623 | :issue_id => '234', :project_id => 'ecookbook' } |
|
|||
624 | ) |
|
|||
625 | assert_routing( |
|
|||
626 | { :method => 'post', |
|
|||
627 | :path => "/projects/ecookbook/issues/234/time_entries" }, |
|
|||
628 | { :controller => 'timelog', :action => 'create', |
|
|||
629 | :issue_id => '234', :project_id => 'ecookbook' } |
|
|||
630 | ) |
|
|||
631 | assert_routing( |
|
|||
632 | { :method => 'put', |
|
|||
633 | :path => "/projects/ecookbook/issues/234/time_entries/22" }, |
|
|||
634 | { :controller => 'timelog', :action => 'update', :id => '22', |
|
|||
635 | :issue_id => '234', :project_id => 'ecookbook' } |
|
|||
636 | ) |
|
|||
637 | assert_routing( |
|
|||
638 | { :method => 'delete', |
|
|||
639 | :path => "/projects/ecookbook/issues/234/time_entries/55" }, |
|
|||
640 | { :controller => 'timelog', :action => 'destroy', :id => '55', |
|
|||
641 | :issue_id => '234', :project_id => 'ecookbook' } |
|
|||
642 | ) |
|
|||
643 | assert_routing( |
|
|||
644 | { :method => 'get', |
|
|||
645 | :path => "/time_entries/report" }, |
|
|||
646 | { :controller => 'timelog', :action => 'report' } |
|
|||
647 | ) |
|
|||
648 | assert_routing( |
|
|||
649 | { :method => 'get', |
|
|||
650 | :path => "/projects/567/time_entries/report" }, |
|
|||
651 | { :controller => 'timelog', :action => 'report', :project_id => '567' } |
|
|||
652 | ) |
|
|||
653 | assert_routing( |
|
|||
654 | { :method => 'get', |
|
|||
655 | :path => "/projects/567/time_entries/report.csv" }, |
|
|||
656 | { :controller => 'timelog', :action => 'report', :project_id => '567', |
|
|||
657 | :format => 'csv' } |
|
|||
658 | ) |
|
|||
659 | end |
|
|||
660 |
|
||||
661 | def test_users |
|
478 | def test_users | |
662 | assert_routing( |
|
479 | assert_routing( | |
663 | { :method => 'get', :path => "/users" }, |
|
480 | { :method => 'get', :path => "/users" }, |
General Comments 0
You need to be logged in to leave comments.
Login now