8 my $base = 'http://localhost';
9 my $content_type = [ 'Content-Type', 'application/x-www-form-urlencoded' ];
13 use Test::More tests => 4;
14 use Test::WWW::Mechanize::Catalyst 'RestTest';
15 use HTTP::Request::Common;
17 my $mech = Test::WWW::Mechanize::Catalyst->new;
18 ok(my $schema = DBICTest->init_schema(), 'got schema');
20 my $track = $schema->resultset('Track')->first;
21 my %original_cols = $track->get_columns;
23 my $track_delete_url = "$base/api/rest/track/" . $track->id;
26 my $req = HTTP::Request->new( DELETE => $track_delete_url );
27 $req->content_type('text/x-json');
29 cmp_ok( $mech->status, '==', 200, 'Attempt to delete track ok' );
31 my $deleted_track = $schema->resultset('Track')->find($track->id);
32 is($deleted_track, undef, 'track deleted');
36 my $req = HTTP::Request->new( DELETE => $track_delete_url );
37 $req->content_type('text/x-json');
39 cmp_ok( $mech->status, '==', 400, 'Attempt to delete again caught' );