Akron | b80341d | 2018-10-15 19:46:23 +0200 | [diff] [blame^] | 1 | use Mojo::Base -strict; |
| 2 | use Test::Mojo; |
| 3 | use Test::More; |
| 4 | use Mojo::File qw/path/; |
| 5 | |
| 6 | |
| 7 | ##################### |
| 8 | # Start Fake server # |
| 9 | ##################### |
| 10 | my $mount_point = '/api/'; |
| 11 | $ENV{KALAMAR_API} = $mount_point; |
| 12 | |
| 13 | my $t = Test::Mojo->new('Kalamar'); |
| 14 | |
| 15 | # Mount fake backend |
| 16 | # Get the fixture path |
| 17 | my $fixtures_path = path(Mojo::File->new(__FILE__)->dirname, 'fixtures'); |
| 18 | my $fake_backend = $t->app->plugin( |
| 19 | Mount => { |
| 20 | $mount_point => |
| 21 | $fixtures_path->child('fake_backend.pl') |
| 22 | } |
| 23 | ); |
| 24 | # Configure fake backend |
| 25 | $fake_backend->pattern->defaults->{app}->log($t->app->log); |
| 26 | |
| 27 | # Query passed |
| 28 | $t->get_ok('/corpus2/WPD15/232/39681/p2133-2134?spans=false&foundry=*') |
| 29 | ->status_is(200) |
| 30 | ->json_is('/textSigle', 'WPD15/232/39681') |
| 31 | ; |
| 32 | |
| 33 | done_testing; |