Added the blob_plain, blobdiff_plain and commitdiff_plain actions.
[catagits/Gitalist.git] / t / 03legacy_uri.t
CommitLineData
55046af2 1#!/usr/bin/env perl
2use strict;
3use warnings;
4use Test::More;
5use FindBin qw/$Bin/;
6
7BEGIN {
8 $ENV{GITALIST_CONFIG} = $Bin;
9 use_ok 'Catalyst::Test', 'Gitalist'
10}
11
12ok( request('/')->is_success, 'Request should succeed' );
13
14# URI tests for repo1
15local *test = curry_test_uri('repo1');
16
17test('/', 'a=summary');
18test('/', 'a=heads');
19
20test('/', 'a=blob;f=dir1/file2;h=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
21test('/', 'a=blob;f=dir1/file2;h=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=HEAD');
22test('/', 'a=blob;f=dir1/file2;h=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=master');
23test('/', 'a=blob;f=dir1/file2;h=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=refs/heads/master');
24test('/', 'a=blob;f=dir1/file2;hb=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
25test('/', 'a=blob;f=file1;h=257cc5642cb1a054f08cc83f2d943e56fd3ebe99');
26test('/', 'a=blob;f=file1;h=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=257cc5642cb1a054f08cc83f2d943e56fd3ebe99');
27test('/', 'a=blob;f=file1;h=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
28test('/', 'a=blob;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hb=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
29test('/', 'a=blob;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hb=3f7567c7bdf7e7ebf410926493b92d398333116e');
30test('/', 'a=blob;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hb=5716ca5987cbf97d6bb54920bea6adde242d87e6');
31test('/', 'a=blob;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hb=HEAD');
32test('/', 'a=blob;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hb=master');
33test('/', 'a=blob;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hb=refs/heads/master');
34test('/', 'a=blob;f=file1;hb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
35test('/', 'a=blob;f=file1;hb=3f7567c7bdf7e7ebf410926493b92d398333116e');
36
c8a42dd5 37
38test('/', 'a=blob_plain;f=dir1/file2;hb=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
39test('/', 'a=blob_plain;f=dir1/file2;hb=HEAD');
40test('/', 'a=blob_plain;f=dir1/file2;hb=master');
41test('/', 'a=blob_plain;f=dir1/file2;hb=refs/heads/master');
42test('/', 'a=blob_plain;f=file1;hb=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
43test('/', 'a=blob_plain;f=file1;hb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
44test('/', 'a=blob_plain;f=file1;hb=3f7567c7bdf7e7ebf410926493b92d398333116e');
45test('/', 'a=blob_plain;f=file1;hb=HEAD');
46test('/', 'a=blob_plain;f=file1;hb=master');
47test('/', 'a=blob_plain;f=file1;hb=refs/heads/master');
1236be4d 48
c098de06 49test('/', 'a=blobdiff;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hp=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=36c6c6708b8360d7023e8a1649c45bcf9b3bd818;hpb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
50test('/', 'a=blobdiff;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hp=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=3f7567c7bdf7e7ebf410926493b92d398333116e;hpb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
51test('/', 'a=blobdiff;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hp=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=HEAD;hpb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
52test('/', 'a=blobdiff;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hp=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=master;hpb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
53test('/', 'a=blobdiff;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hp=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=refs/heads/master;hpb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
1236be4d 54
c8a42dd5 55test('/', 'a=blobdiff_plain;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hp=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=36c6c6708b8360d7023e8a1649c45bcf9b3bd818;hpb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
56test('/', 'a=blobdiff_plain;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hp=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=3f7567c7bdf7e7ebf410926493b92d398333116e;hpb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
57test('/', 'a=blobdiff_plain;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hp=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=HEAD;hpb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
58test('/', 'a=blobdiff_plain;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hp=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=master;hpb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
55046af2 59
60test('/', 'a=commit');
61test('/', 'a=commit;h=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
62test('/', 'a=commit;h=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
63test('/', 'a=commit;h=3f7567c7bdf7e7ebf410926493b92d398333116e');
64test('/', 'a=commit;h=HEAD');
65test('/', 'a=commit;h=master');
66test('/', 'a=commit;h=refs/heads/master');
67test('/', 'a=commit;hb=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
68test('/', 'a=commit;hb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
69test('/', 'a=commit;hb=3f7567c7bdf7e7ebf410926493b92d398333116e');
70
71test('/', 'a=commitdiff');
72test('/', 'a=commitdiff;h=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
73test('/', 'a=commitdiff;h=36c6c6708b8360d7023e8a1649c45bcf9b3bd818;hp=3f7567c7bdf7e7ebf410926493b92d398333116e');
74test('/', 'a=commitdiff;h=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
75test('/', 'a=commitdiff;h=3f7567c7bdf7e7ebf410926493b92d398333116e');
76test('/', 'a=commitdiff;h=3f7567c7bdf7e7ebf410926493b92d398333116e;hp=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
77test('/', 'a=commitdiff;h=HEAD');
78test('/', 'a=commitdiff;h=HEAD;hp=3f7567c7bdf7e7ebf410926493b92d398333116e');
79test('/', 'a=commitdiff;h=master');
80test('/', 'a=commitdiff;h=master;hp=3f7567c7bdf7e7ebf410926493b92d398333116e');
81test('/', 'a=commitdiff;h=refs/heads/master');
82test('/', 'a=commitdiff;h=refs/heads/master;hp=3f7567c7bdf7e7ebf410926493b92d398333116e');
1236be4d 83
c8a42dd5 84test('/', 'a=commitdiff_plain');
85test('/', 'a=commitdiff_plain;h=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
86test('/', 'a=commitdiff_plain;h=36c6c6708b8360d7023e8a1649c45bcf9b3bd818;hp=3f7567c7bdf7e7ebf410926493b92d398333116e');
87test('/', 'a=commitdiff_plain;h=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
88test('/', 'a=commitdiff_plain;h=3f7567c7bdf7e7ebf410926493b92d398333116e');
89test('/', 'a=commitdiff_plain;h=3f7567c7bdf7e7ebf410926493b92d398333116e;hp=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
90test('/', 'a=commitdiff_plain;h=HEAD');
91test('/', 'a=commitdiff_plain;h=HEAD;hp=3f7567c7bdf7e7ebf410926493b92d398333116e');
92test('/', 'a=commitdiff_plain;h=master');
93test('/', 'a=commitdiff_plain;h=master;hp=3f7567c7bdf7e7ebf410926493b92d398333116e');
94test('/', 'a=commitdiff_plain;h=refs/heads/master');
95test('/', 'a=commitdiff_plain;h=refs/heads/master;hp=3f7567c7bdf7e7ebf410926493b92d398333116e');
1236be4d 96
c8a42dd5 97
98test('/', 'a=history;f=dir1/file2;h=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
99test('/', 'a=history;f=dir1/file2;h=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=HEAD');
100test('/', 'a=history;f=dir1/file2;h=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=master');
101test('/', 'a=history;f=dir1/file2;h=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=refs/heads/master');
102test('/', 'a=history;f=dir1;h=729a7c3f6ba5453b42d16a43692205f67fb23bc1;hb=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
103test('/', 'a=history;f=dir1;h=729a7c3f6ba5453b42d16a43692205f67fb23bc1;hb=HEAD');
104test('/', 'a=history;f=dir1;h=729a7c3f6ba5453b42d16a43692205f67fb23bc1;hb=master');
105test('/', 'a=history;f=dir1;h=729a7c3f6ba5453b42d16a43692205f67fb23bc1;hb=refs/heads/master');
106test('/', 'a=history;f=dir1;hb=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
107test('/', 'a=history;f=dir1;hb=HEAD');
108test('/', 'a=history;f=dir1;hb=master');
109test('/', 'a=history;f=dir1;hb=refs/heads/master');
110test('/', 'a=history;f=file1;h=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
111test('/', 'a=history;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hb=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
112test('/', 'a=history;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hb=3f7567c7bdf7e7ebf410926493b92d398333116e');
113test('/', 'a=history;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hb=HEAD');
114test('/', 'a=history;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hb=master');
115test('/', 'a=history;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hb=refs/heads/master');
116test('/', 'a=history;f=file1;hb=3f7567c7bdf7e7ebf410926493b92d398333116e');
117test('/', 'a=history;h=refs/heads/master');
55046af2 118
119test('/', 'a=log');
120test('/', 'a=log;h=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
121test('/', 'a=log;h=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
122test('/', 'a=log;h=3f7567c7bdf7e7ebf410926493b92d398333116e');
123test('/', 'a=log;h=HEAD');
124test('/', 'a=log;h=master');
125test('/', 'a=log;h=refs/heads/master');
126
1236be4d 127TODO: {
128 local $TODO = "Action: patch is not yet implemented.";
129 test('/', 'a=patch');
130 test('/', 'a=patch;h=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
131 test('/', 'a=patch;h=36c6c6708b8360d7023e8a1649c45bcf9b3bd818;hp=3f7567c7bdf7e7ebf410926493b92d398333116e');
132 test('/', 'a=patch;h=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
133 test('/', 'a=patch;h=3f7567c7bdf7e7ebf410926493b92d398333116e');
134 test('/', 'a=patch;h=3f7567c7bdf7e7ebf410926493b92d398333116e;hp=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
135 test('/', 'a=patch;h=HEAD');
136 test('/', 'a=patch;h=HEAD;hp=3f7567c7bdf7e7ebf410926493b92d398333116e');
137 test('/', 'a=patch;h=master');
138 test('/', 'a=patch;h=master;hp=3f7567c7bdf7e7ebf410926493b92d398333116e');
139 test('/', 'a=patch;h=refs/heads/master');
140 test('/', 'a=patch;h=refs/heads/master;hp=3f7567c7bdf7e7ebf410926493b92d398333116e');
141 test('/', 'a=patch;hb=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
142 test('/', 'a=patch;hb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
143 test('/', 'a=patch;hb=3f7567c7bdf7e7ebf410926493b92d398333116e');
144}
145
146TODO: {
147 local $TODO = "Action: patches is not yet implemented.";
148 test('/', 'a=patches');
149 test('/', 'a=patches;h=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
150 test('/', 'a=patches;h=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
151 test('/', 'a=patches;h=3f7567c7bdf7e7ebf410926493b92d398333116e');
152 test('/', 'a=patches;h=HEAD');
153 test('/', 'a=patches;h=master');
154 test('/', 'a=patches;h=refs/heads/master');
155}
156
157TODO: {
158 local $TODO = "Action: search_help is not yet implemented.";
159 test('/', 'a=search_help');
160}
55046af2 161
162test('/', 'a=shortlog');
163test('/', 'a=shortlog;h=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
164test('/', 'a=shortlog;h=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
165test('/', 'a=shortlog;h=3f7567c7bdf7e7ebf410926493b92d398333116e');
166test('/', 'a=shortlog;h=HEAD');
167test('/', 'a=shortlog;h=master');
168test('/', 'a=shortlog;h=refs/heads/master');
169
1236be4d 170TODO: {
171 local $TODO = "Action: snapshot is not yet implemented.";
172 test('/', 'a=snapshot;h=145dc3ef5d307be84cb9b325d70bd08aeed0eceb;sf=tgz');
173 test('/', 'a=snapshot;h=36c6c6708b8360d7023e8a1649c45bcf9b3bd818;sf=tgz');
174 test('/', 'a=snapshot;h=3bc0634310b9c62222bb0e724c11ffdfb297b4ac;sf=tgz');
175 test('/', 'a=snapshot;h=3f7567c7bdf7e7ebf410926493b92d398333116e;sf=tgz');
176 test('/', 'a=snapshot;h=729a7c3f6ba5453b42d16a43692205f67fb23bc1;sf=tgz');
177 test('/', 'a=snapshot;h=82b5fee28277349b6d46beff5fdf6a7152347ba0;sf=tgz');
178 test('/', 'a=snapshot;h=9062594aebb5df0de7fb92413f17a9eced196c22;sf=tgz');
179 test('/', 'a=snapshot;h=HEAD;sf=tgz');
180 test('/', 'a=snapshot;h=master;sf=tgz');
181 test('/', 'a=snapshot;h=refs/heads/master;sf=tgz');
182}
55046af2 183
184test('/', 'a=tree');
185test('/', 'a=tree;f=dir1;h=729a7c3f6ba5453b42d16a43692205f67fb23bc1;hb=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
186test('/', 'a=tree;f=dir1;h=729a7c3f6ba5453b42d16a43692205f67fb23bc1;hb=HEAD');
187test('/', 'a=tree;f=dir1;h=729a7c3f6ba5453b42d16a43692205f67fb23bc1;hb=master');
188test('/', 'a=tree;f=dir1;h=729a7c3f6ba5453b42d16a43692205f67fb23bc1;hb=refs/heads/master');
189test('/', 'a=tree;f=dir1;hb=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
190test('/', 'a=tree;f=dir1;hb=HEAD');
191test('/', 'a=tree;f=dir1;hb=master');
192test('/', 'a=tree;f=dir1;hb=refs/heads/master');
193test('/', 'a=tree;h=145dc3ef5d307be84cb9b325d70bd08aeed0eceb;hb=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
194test('/', 'a=tree;h=145dc3ef5d307be84cb9b325d70bd08aeed0eceb;hb=HEAD');
195test('/', 'a=tree;h=145dc3ef5d307be84cb9b325d70bd08aeed0eceb;hb=master');
196test('/', 'a=tree;h=145dc3ef5d307be84cb9b325d70bd08aeed0eceb;hb=refs/heads/master');
197test('/', 'a=tree;h=36c6c6708b8360d7023e8a1649c45bcf9b3bd818;hb=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
198test('/', 'a=tree;h=3bc0634310b9c62222bb0e724c11ffdfb297b4ac;hb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
199test('/', 'a=tree;h=3f7567c7bdf7e7ebf410926493b92d398333116e;hb=3f7567c7bdf7e7ebf410926493b92d398333116e');
200test('/', 'a=tree;h=82b5fee28277349b6d46beff5fdf6a7152347ba0;hb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
201test('/', 'a=tree;h=9062594aebb5df0de7fb92413f17a9eced196c22;hb=3f7567c7bdf7e7ebf410926493b92d398333116e');
202test('/', 'a=tree;h=HEAD;hb=HEAD');
203test('/', 'a=tree;h=master;hb=master');
204test('/', 'a=tree;h=refs/heads/master;hb=master');
205test('/', 'a=tree;h=refs/heads/master;hb=refs/heads/master');
206test('/', 'a=tree;hb=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
207test('/', 'a=tree;hb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
208test('/', 'a=tree;hb=3f7567c7bdf7e7ebf410926493b92d398333116e');
209test('/', 'a=tree;hb=HEAD');
210test('/', 'a=tree;hb=master');
211test('/', 'a=tree;hb=refs/heads/master');
212
1236be4d 213TODO: {
214 local $TODO = "Action: atom is not yet implemented.";
215 test('/', 'a=atom');
216 test('/', 'a=atom;f=dir1');
217 test('/', 'a=atom;f=dir1/file2');
218 test('/', 'a=atom;f=dir1/file2;opt=--no-merges');
219 test('/', 'a=atom;f=dir1;h=refs/heads/master');
220 test('/', 'a=atom;f=dir1;h=refs/heads/master;opt=--no-merges');
221 test('/', 'a=atom;f=dir1;opt=--no-merges');
222 test('/', 'a=atom;f=file1');
223 test('/', 'a=atom;f=file1;h=refs/heads/master');
224 test('/', 'a=atom;f=file1;h=refs/heads/master;opt=--no-merges');
225 test('/', 'a=atom;f=file1;opt=--no-merges');
226 test('/', 'a=atom;h=refs/heads/master');
227 test('/', 'a=atom;h=refs/heads/master;opt=--no-merges');
228 test('/', 'a=atom;opt=--no-merges');
229}
55046af2 230
1236be4d 231TODO: {
232 local $TODO = "Action: rss is not yet implemented.";
233 test('/', 'a=rss');
234 test('/', 'a=rss;f=dir1');
235 test('/', 'a=rss;f=dir1/file2');
236 test('/', 'a=rss;f=dir1/file2;opt=--no-merges');
237 test('/', 'a=rss;f=dir1;h=refs/heads/master');
238 test('/', 'a=rss;f=dir1;h=refs/heads/master;opt=--no-merges');
239 test('/', 'a=rss;f=dir1;opt=--no-merges');
240 test('/', 'a=rss;f=file1');
241 test('/', 'a=rss;f=file1;h=refs/heads/master');
242 test('/', 'a=rss;f=file1;h=refs/heads/master;opt=--no-merges');
243 test('/', 'a=rss;f=file1;opt=--no-merges');
244 test('/', 'a=rss;h=refs/heads/master');
245 test('/', 'a=rss;h=refs/heads/master;opt=--no-merges');
246 test('/', 'a=rss;opt=--no-merges');
247}
55046af2 248
249done_testing;
250
251sub test_uri {
252 my ($p, $uri, $qs) = @_;
253 $qs ||= '';
254 my $request = "$uri?p=repo1;$qs";
55046af2 255 my $response = request($request);
256 ok($response->is_success, "ok $request");
257}
258
259sub curry_test_uri {
260 my $p = shift;
261 sub {
262 my ($uri, $qs) = @_;
263 test_uri($p, $uri, $qs);
264 };
265};