move drivers to better namespace
[catagits/catbook-code.git] / t / 01app.t
CommitLineData
cc003be0 1 use strict;
2 use warnings;
3# use Test::More qw/no_plan/;
4use Test::More tests => 13;
5
6
7 BEGIN { use_ok 'Catalyst::Test', 'LolCatalyst::Lite' }
8 use HTTP::Headers;
9 use HTTP::Request::Common;
10
11 # GET request
12
13 my $request = GET('http://localhost');
14 my $response = request($request);
15 ok( $response = request($request), 'Request');
16 ok( $response->is_success, 'Response Successful 2xx' );
17 is( $response->content_type, 'text/html', 'Response Content-Type' );
18 like( $response->content, qr/Translate/, "contains translated string");
19
20 # test request to translate
21
22 $request = POST(
23 'http://localhost/translate',
24 'Content-Type' => 'form-data',
25 'Content' => [
26 'lol' => 'Can i have a cheese burger?',
27 ]);
28
29 ok( $response = request($request), 'Request');
30 ok( $response->is_success, 'Response Successful 2xx' );
31 is( $response->content_type, 'text/html', 'Response Content-Type' );
32 like( $response->content, qr/CHEEZ/, "contains translated string");
33
34 # test request to translate_service
35
36 $request = POST(
37 'http://localhost/translate_service',
38 'Content-Type' => 'form-data',
39 'Content' => [
40 'lol' => 'Can i have a cheese burger?',
41 ]);
42 ok($response = request($request), 'Request');
43 ok( $response->is_success, 'Response Successful 2xx' );
44 is( $response->content_type, 'application/json', 'Response Content-Type' );
45 like( $response->content, qr/CHEEZ/, "contains translated string");
46
47