Sniperovitch 8 years ago
parent
commit
712ae4cb82
2 changed files with 33 additions and 0 deletions
  1. 16 0
      t/002_index_route.t
  2. 17 0
      t/003_status_route.t

+ 16 - 0
t/002_index_route.t

@@ -0,0 +1,16 @@
+use strict;
+use warnings;
+use Data::Dumper;
+
+use Bartender;
+use Test::More tests => 3;
+use Plack::Test;
+use HTTP::Request::Common;
+
+my $app = Bartender->to_app;
+is( ref $app, 'CODE', 'Got app' );
+my $test = Plack::Test->create($app);
+my $res  = $test->request( GET '/' );
+ok( $res->is_success, '[GET /] successful' );
+is( $res->content, "Welcome on Bartender", '[GET / content] successful' );
+

+ 17 - 0
t/003_status_route.t

@@ -0,0 +1,17 @@
+use strict;
+use warnings;
+use Data::Dumper;
+
+use Bartender;
+use Test::More tests => 2;
+use Plack::Test;
+use HTTP::Request::Common;
+use JSON ();
+
+my $app = Bartender->to_app;
+my $test = Plack::Test->create($app);
+my $res  = $test->request( GET '/status?dossier=foo&projetId=bar' );
+ok( $res->is_success, '[GET /status] successful' );
+my $compilation = JSON::decode_json( $res->content );
+is( $compilation->{status}, 'NONE', '[GET /status NONE] successful' );
+