Debian Codegraph @

lemonldap-ng-manager/t/02-HTML-template.t

raw
1 # Verify just that '/' requests returns HTML and some elements
2
3 use Test::More;
4 use strict;
5 use warnings;
6
7 require 't/test-lib.pm';
8
9 my $res;
10
11 my $client = LLNG::Manager::Test->new;
12
13 ok( $res = $client->_get('/'), 'Succeed to get /' );
14 my %hdrs = @{ $res->[1] };
15 ok( $res->[0] == 200, 'Return a 200 code' )
16 or print STDERR "Received" . Dumper($res);
17 ok( $hdrs{'Content-Type'} =~ /text\/html$/i, 'Content is declared as HTML' );
18 ok( $res->[2]->[0] =~ /<html/si, 'It contains a html tag' );
19 ok( $res->[2]->[0] =~ m#<title>Demo Manager</title>#,
20 'Instance name found in SPA title' )
21 or print STDERR "Instance name" . Dumper( $res->[2]->[0] );
22 ok( $res->[2]->[0] =~ m#title="Demo" src=#, 'Instance name found in title' )
23 or print STDERR "Instance name" . Dumper( $res->[2]->[0] );
24 ok(
25 $res->[2]->[0] =~
26 m#<li><a href="https://lemonldap-ng.org/team.html">Demo</a></li>#,
27 'Instance name found in li'
28 ) or print STDERR "Instance name" . Dumper( $res->[2]->[0] );
29 count(7);
30
31 done_testing( count() );