| use Mojo::Base -strict; |
| use Test::Mojo; |
| use Test::More; |
| use Mojo::File qw/path/; |
| |
| |
| ##################### |
| # Start Fake server # |
| ##################### |
| my $mount_point = '/api/'; |
| $ENV{KALAMAR_API} = $mount_point; |
| |
| my $t = Test::Mojo->new('Kalamar'); |
| |
| # Mount fake backend |
| # Get the fixture path |
| my $fixtures_path = path(Mojo::File->new(__FILE__)->dirname, 'fixtures'); |
| my $fake_backend = $t->app->plugin( |
| Mount => { |
| $mount_point => |
| $fixtures_path->child('fake_backend.pl') |
| } |
| ); |
| # Configure fake backend |
| $fake_backend->pattern->defaults->{app}->log($t->app->log); |
| |
| # Query passed |
| $t->get_ok('/q2?q=baum') |
| ->status_is(200) |
| ->text_is('#error','') |
| ->text_is('title', 'KorAP: Find »baum« with Poliqarp') |
| ->element_exists('meta[name="DC.title"][content="KorAP: Find »baum« with Poliqarp"]') |
| ->element_exists('body[itemscope][itemtype="http://schema.org/SearchResultsPage"]') |
| ->text_is('#total-results', 51) |
| ; |
| |
| |
| |
| done_testing; |