diff options
| author | Jonathan "Duke" Leto <jonathan@leto.net> | 2011-05-22 20:08:18 -0700 |
|---|---|---|
| committer | Jonathan "Duke" Leto <jonathan@leto.net> | 2011-05-22 20:08:18 -0700 |
| commit | 77b0c36408113a9719397f5acbbd73a5f431e7d6 (patch) | |
| tree | 4201457a31550c418b0b4cb218fe28deac52c541 /scripts/trigger_hook | |
| parent | Use test db (diff) | |
| download | jitterbug-77b0c36408113a9719397f5acbbd73a5f431e7d6.tar.gz | |
Rename trigger script
Diffstat (limited to 'scripts/trigger_hook')
| -rw-r--r-- | scripts/trigger_hook | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/scripts/trigger_hook b/scripts/trigger_hook deleted file mode 100644 index 2e2f717..0000000 --- a/scripts/trigger_hook +++ /dev/null @@ -1,56 +0,0 @@ -use strict; -use warnings; - -use jitterbug; -use jitterbug::Schema; - -use JSON; -use YAML qw/LoadFile Dump/; - -use File::Temp qw/tempdir/; - -use Dancer::Test; -use Dancer::Config qw/setting/; -use File::Spec::Functions; - -my $content = LoadFile(catfile(qw/t data hook_data.yml/)); -my $db_file = catfile( qw/t data jitterbug.db/ ); -my $dsn = 'dbi:SQLite:dbname=' . $db_file; -my $schema = jitterbug::Schema->connect($dsn); -# assume we have a deployed schema -# $schema->deploy; - -setting plugins => { - DBIC => { - schema => { - skip_automake => 1, - pckg => "jitterbug::Schema", - connect_info => [$dsn] - } - } -}; - -{ - my $response = dancer_response( - POST => '/hook/', - { - headers => - [ 'Content-Type' => 'application/x-www-form-urlencoded' ], - body => _generate_post_request($content), - } - ); - - printf "Response was: %s\n", $response->{status}; -} - -sub _generate_post_request { - my $content = shift; - 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; - return $payload; -} - |
