about summary refs log tree commit diff
path: root/t/003_hook_route.t
blob: 9929553878787187f5867bad374d9b73831f6226 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use Test::More tests => 1;
use strict;
use warnings;
ok 1;
#use jitterbug;
#use JSON;
#use YAML qw/LoadFile/;
#use Dancer::Test;
#use Dancer::Config qw/setting/;

#my $content = LoadFile('t/data/test.yaml');

#setting jitterbug => { namespace => 'jitterbug_test' };

#route_exists [ POST => '/hook/' ], 'a route handle is defined for /';

#my $response;

#{
    #$response = dancer_response( POST => '/hook', );
    #is $response->{status}, 200, '200 with empty post';
#}

#{
    #my $payload = "payload=" . JSON::encode_json($content);
    #open my $in, '<', \$payload;

    #$ENV{'CONTENT_LENGTH'} = length($payload);
    #$ENV{'CONTENT_TYPE'}   = 'application/x-www-form-urlencoded';
    #$ENV{'psgi.input'}     = $in;

    #$response = dancer_response(
        #POST => '/hook/',
        #{
            #headers => [ 'Content-Length' => length($payload) ],
            #body    => $payload
        #}
    #);

    #is $response->{status}, 200;
    #is_deeply JSON::decode_json( $response->{content} ),
      #{ updated => 'Dancer' };
#}