Commit | Line | Data |
5f79e33f |
1 | #!/usr/bin/env perl |
cce03a80 |
2 | |
3 | use FindBin qw/$Bin/; |
4 | BEGIN { do "$FindBin::Bin/../script/env" or die $@ } |
5 | |
5f79e33f |
6 | use strict; |
7 | use warnings; |
8 | use Test::More; |
9 | use HTTP::Request::Common; |
5f79e33f |
10 | use JSON::Any; |
11 | |
cce03a80 |
12 | |
5f79e33f |
13 | BEGIN { |
14 | $ENV{GITALIST_CONFIG} = $Bin; |
15 | $ENV{GITALIST_REPO_DIR} = ''; |
16 | use_ok 'Catalyst::Test', 'Gitalist'; |
17 | } |
18 | |
19 | my $j = JSON::Any->new; |
20 | |
cce03a80 |
21 | my $res = request(GET 'http://localhost/repo1', 'Content-Type' => 'application/json'); |
5f79e33f |
22 | is $res->code, 200; |
23 | my $data = $j->decode($res->content); |
24 | is ref($data), 'HASH'; |
cce03a80 |
25 | delete $data->{owner} |
26 | if $data && exists $data->{owner}; |
5f79e33f |
27 | is_deeply $data, { |
5f79e33f |
28 | 'is_bare' => 1, |
29 | '__CLASS__' => 'Gitalist::Git::Repository', |
30 | 'last_change' => '2009-11-12T19:00:34Z', |
31 | 'references' => { |
32 | '0710a7c8ee11c73e8098d08f9384c2a839c65e4e' => [ |
33 | 'heads/branch1' |
34 | ], |
35 | '36c6c6708b8360d7023e8a1649c45bcf9b3bd818' => [ |
cce03a80 |
36 | 'heads/master', |
37 | 'tags/0.01' |
5f79e33f |
38 | ] |
39 | }, |
40 | 'name' => 'repo1', |
41 | 'description' => 'some test repository' |
42 | }; |
43 | |
44 | done_testing; |
45 | |
46 | |