fix 'C' and 'M' tests in 'gitolite access'...
[gitolite.git] / t / access.t
blobc3f3341cd09ed0f50b218b32826a82c553192b3a
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
5 # this is hardcoded; change it if needed
6 use lib "src/lib";
7 use Gitolite::Test;
9 # test 'gitolite access'
10 # ----------------------------------------------------------------------
12 try "plan 254";
14 confreset;confadd '
15 @admins = admin dev1
16 repo gitolite-admin
17 RW+ = admin
19 repo testing
20 RW+ = @all
22 @g1 = t1
23 repo @g1
24 R = u2
25 RW = u3
26 RW+ = u4
29 try "ADMIN_PUSH set1; !/FATAL/" or die text();
31 try "
33 gitolite access -q t1 u1; !ok; !/./
34 gitolite access -q t1 u1 R; !ok; !/./
35 gitolite access -q t1 u1 W; !ok; !/./
36 gitolite access -q t1 u1 +; !ok; !/./
37 gitolite access -q t1 u2; !ok; !/./
38 gitolite access -q t1 u2 R; ok; !/./
39 gitolite access -q t1 u2 W; !ok; !/./
40 gitolite access -q t1 u2 +; !ok; !/./
41 gitolite access -q t1 u3; !ok; !/./
42 gitolite access -q t1 u3 R; ok; !/./
43 gitolite access -q t1 u3 W; ok; !/./
44 gitolite access -q t1 u3 +; !ok; !/./
45 gitolite access -q t1 u4; ok; !/./
46 gitolite access -q t1 u4 R; ok; !/./
47 gitolite access -q t1 u4 W; ok; !/./
48 gitolite access -q t1 u4 +; ok; !/./
50 gitolite access t1 u1; !ok; /\\+ any t1 u1 DENIED by fallthru/
51 gitolite access t1 u1 R; !ok; /R any t1 u1 DENIED by fallthru/
52 gitolite access t1 u1 W; !ok; /W any t1 u1 DENIED by fallthru/
53 gitolite access t1 u1 +; !ok; /\\+ any t1 u1 DENIED by fallthru/
54 gitolite access t1 u2; !ok; /\\+ any t1 u2 DENIED by fallthru/
55 gitolite access t1 u2 R; ok; /refs/\.\*/
56 gitolite access t1 u2 W; !ok; /W any t1 u2 DENIED by fallthru/
57 gitolite access t1 u2 +; !ok; /\\+ any t1 u2 DENIED by fallthru/
58 gitolite access t1 u3; !ok; /\\+ any t1 u3 DENIED by fallthru/
59 gitolite access t1 u3 R; ok; /refs/\.\*/
60 gitolite access t1 u3 W; ok; /refs/\.\*/
61 gitolite access t1 u3 +; !ok; /\\+ any t1 u3 DENIED by fallthru/
62 gitolite access t1 u4; ok; /refs/\.\*/
63 gitolite access t1 u4 R; ok; /refs/\.\*/
64 gitolite access t1 u4 W; ok; /refs/\.\*/
65 gitolite access t1 u4 +; ok; /refs/\.\*/
69 confreset;confadd '
70 @admins = admin dev1
71 repo gitolite-admin
72 RW+ = admin
74 @g1 = u1
75 @g2 = u2
76 @g3 = u3
77 @gaa = aa
78 repo @gaa
79 RW+ = @g1
80 RW = @g2
81 RW+ master = @g3
82 RW master = u4
83 - master = u5
84 RW+ dev = u5
85 RW = u5
88 try "ADMIN_PUSH set2; !/FATAL/" or die text();
90 try "
91 gitolite access \@gaa \@g1 + any ; ok; /refs/.*/; !/DENIED/
92 gitolite access aa \@g1 + refs/heads/master ; ok; /refs/.*/; !/DENIED/
93 gitolite access \@gaa \@g1 + refs/heads/next ; ok; /refs/.*/; !/DENIED/
94 gitolite access \@gaa \@g1 W refs/heads/next ; ok; /refs/.*/; !/DENIED/
95 gitolite access \@gaa u1 + refs/heads/dev ; ok; /refs/.*/; !/DENIED/
96 gitolite access \@gaa u1 + refs/heads/next ; ok; /refs/.*/; !/DENIED/
97 gitolite access aa u1 W refs/heads/next ; ok; /refs/.*/; !/DENIED/
98 gitolite access \@gaa \@g2 + refs/heads/master ; !ok; /\\+ refs/heads/master \@gaa \@g2 DENIED by fallthru/
99 gitolite access \@gaa \@g2 + refs/heads/next ; !ok; /\\+ refs/heads/next \@gaa \@g2 DENIED by fallthru/
100 gitolite access aa \@g2 W refs/heads/master ; ok; /refs/.*/; !/DENIED/
101 gitolite access aa u2 + any ; !ok; /\\+ any aa u2 DENIED by fallthru/
102 gitolite access \@gaa u2 + refs/heads/master ; !ok; /\\+ refs/heads/master \@gaa u2 DENIED by fallthru/
103 gitolite access \@gaa u2 W refs/heads/master ; ok; /refs/.*/; !/DENIED/
104 gitolite access \@gaa \@g3 + refs/heads/master ; ok; /refs/heads/master/; !/DENIED/
105 gitolite access \@gaa \@g3 W refs/heads/next ; !ok; /W refs/heads/next \@gaa \@g3 DENIED by fallthru/
106 gitolite access \@gaa \@g3 W refs/heads/dev ; !ok; /W refs/heads/dev \@gaa \@g3 DENIED by fallthru/
107 gitolite access aa u3 + refs/heads/dev ; !ok; /\\+ refs/heads/dev aa u3 DENIED by fallthru/
108 gitolite access aa u3 + refs/heads/next ; !ok; /\\+ refs/heads/next aa u3 DENIED by fallthru/
109 gitolite access \@gaa u4 + refs/heads/master ; !ok; /\\+ refs/heads/master \@gaa u4 DENIED by fallthru/
110 gitolite access \@gaa u4 W refs/heads/master ; ok; /refs/heads/master/; !/DENIED/
111 gitolite access aa u4 + refs/heads/next ; !ok; /\\+ refs/heads/next aa u4 DENIED by fallthru/
112 gitolite access \@gaa u4 W refs/heads/next ; !ok; /W refs/heads/next \@gaa u4 DENIED by fallthru/
113 gitolite access \@gaa u5 R any ; ok; /refs/heads/dev/; !/DENIED/
114 gitolite access aa u5 R any ; ok; /refs/heads/dev/; !/DENIED/
115 gitolite access \@gaa u5 + refs/heads/dev ; ok; /refs/heads/dev/; !/DENIED/
116 gitolite access \@gaa u5 + refs/heads/master ; !ok; /\\+ refs/heads/master \@gaa u5 DENIED by refs/heads/master/
117 gitolite access aa u5 + refs/heads/next ; !ok; /\\+ refs/heads/next aa u5 DENIED by fallthru/
118 gitolite access \@gaa u5 R refs/heads/dev ; ok; /refs/heads/dev/; !/DENIED/
119 gitolite access \@gaa u5 R refs/heads/master ; !ok; /R refs/heads/master \@gaa u5 DENIED by refs/heads/master/
120 gitolite access \@gaa u5 R refs/heads/next ; ok; /refs/.*/; !/DENIED/
121 gitolite access aa u5 W refs/heads/dev ; ok; /refs/heads/dev/; !/DENIED/
122 gitolite access aa u5 W refs/heads/master ; !ok; /W refs/heads/master aa u5 DENIED by refs/heads/master/
123 gitolite access \@gaa u5 W refs/heads/next ; ok; /refs/.*/; !/DENIED/
126 confreset;confadd '
127 @admins = admin dev1
128 repo gitolite-admin
129 RW+ = admin
131 @gr1 = r1
132 repo @gr1
133 RW refs/heads/v[0-9] = u1
134 RW refs/heads = tester
136 @gr2 = r2
137 repo @gr2
138 RW refs/heads/v[0-9] = u1
139 - refs/heads/v[0-9] = tester
140 RW refs/heads = tester
143 try "ADMIN_PUSH set3; !/FATAL/" or die text();
145 try "
146 gitolite access \@gr2 tester W refs/heads/v1; !ok; /W refs/heads/v1 \@gr2 tester DENIED by refs/heads/v\\[0-9\\]/
147 gitolite access \@gr1 tester W refs/heads/v1; ok; /refs/heads/; !/DENIED/
148 gitolite access r1 tester W refs/heads/v1; ok; /refs/heads/; !/DENIED/
149 gitolite access r2 tester W refs/heads/v1; !ok; /W refs/heads/v1 r2 tester DENIED by refs/heads/v\\[0-9\\]/
150 gitolite access r2 tester W refs/heads/va; ok; /refs/heads/; !/DENIED/
153 confreset;confadd '
154 repo foo
155 RW+ = u1
157 @gr1 = foo bar
159 repo @gr1
160 RW = u2
161 R = u3
163 repo @all
164 R = gitweb
166 repo c0
167 RW+ = @all
168 repo c1
169 RWC = u1
170 RW+ = @all
173 try "ADMIN_PUSH set4; !/FATAL/" or die text();
175 try "
176 gitolite access foo u1 +; ok
177 gitolite access foo u2 +; !ok
178 gitolite access foo u3 +; !ok
179 gitolite access foo u4 +; !ok
180 gitolite access foo gitweb +; !ok
182 gitolite access foo u1 W; ok
183 gitolite access foo u2 W; ok
184 gitolite access foo u3 W; !ok
185 gitolite access foo u4 W; !ok
186 gitolite access foo gitweb W; !ok
188 gitolite access foo u1 R; ok
189 gitolite access foo u2 R; ok
190 gitolite access foo u3 R; ok
191 gitolite access foo u4 R; !ok
192 gitolite access foo gitweb R; ok
194 gitolite access c0 u1 +; ok
195 gitolite access c0 u1 C; ok
196 gitolite access c0 u2 +; ok
197 gitolite access c0 u2 C; ok
198 gitolite access c1 u1 +; ok
199 gitolite access c1 u1 C; ok
200 gitolite access c1 u2 +; ok
201 gitolite access c1 u2 C; !ok
204 confreset;confadd '
205 repo foo
206 R = u1
207 RW = u2
208 RW+ = u3
210 repo bar
211 R = u1
212 RW = u2
213 RW+ = u3
214 RW+CDM = u6
218 try "ADMIN_PUSH set4; !/FATAL/" or die text();
220 try "
221 gitolite access foo u1 +; !ok
222 gitolite access foo u2 +; !ok
223 gitolite access foo u3 +; ok
224 gitolite access foo u1 C; !ok
225 gitolite access foo u2 C; ok
226 gitolite access foo u3 C; ok
227 gitolite access foo u1 D; !ok
228 gitolite access foo u2 D; !ok
229 gitolite access foo u3 D; ok
230 gitolite access foo u1 M; !ok
231 gitolite access foo u2 M; ok
232 gitolite access foo u3 M; ok
234 gitolite access bar u1 +; !ok
235 gitolite access bar u2 +; !ok
236 gitolite access bar u3 +; ok
237 gitolite access bar u1 C; !ok
238 gitolite access bar u2 C; !ok
239 gitolite access bar u3 C; !ok
240 gitolite access bar u1 D; !ok
241 gitolite access bar u2 D; !ok
242 gitolite access bar u3 D; !ok
243 gitolite access bar u1 M; !ok
244 gitolite access bar u2 M; !ok
245 gitolite access bar u3 M; !ok
247 gitolite access bar u6 R; ok
248 gitolite access bar u6 W; ok
249 gitolite access bar u6 +; ok
250 gitolite access bar u6 C; ok
251 gitolite access bar u6 D; ok
252 gitolite access bar u6 M; ok