Commit | Line | Data |
cc003be0 |
1 | use strict; |
2 | use warnings; |
07c4c36a |
3 | use Test::More qw/no_plan/; |
cc003be0 |
4 | |
5 | |
6 | BEGIN { use_ok 'Catalyst::Test', 'LolCatalyst::Lite' } |
7 | use HTTP::Headers; |
8 | use HTTP::Request::Common; |
9 | |
10 | # GET request |
11 | |
12 | my $request = GET('http://localhost'); |
13 | my $response = request($request); |
14 | ok( $response = request($request), 'Request'); |
15 | ok( $response->is_success, 'Response Successful 2xx' ); |
16 | is( $response->content_type, 'text/html', 'Response Content-Type' ); |
17 | like( $response->content, qr/Translate/, "contains translated string"); |
18 | |
cc003be0 |
19 | # test request to translate_service |
20 | |
21 | $request = POST( |
22 | 'http://localhost/translate_service', |
23 | 'Content-Type' => 'form-data', |
24 | 'Content' => [ |
25 | 'lol' => 'Can i have a cheese burger?', |
26 | ]); |
27 | ok($response = request($request), 'Request'); |
28 | ok( $response->is_success, 'Response Successful 2xx' ); |
29 | is( $response->content_type, 'application/json', 'Response Content-Type' ); |
30 | like( $response->content, qr/CHEEZ/, "contains translated string"); |
31 | |
32 | |