File Coverage

File:t/run.t
Coverage:100.0%

linestmtbrancondsubpodtimecode
1#!/usr/bin/env perl
2
1
1
1
2070
1
28
use strict;
3
1
1
1
3
2
14
use warnings;
4
5
1
1
1
163
295
2
use lib 't/lib';
6
1
1
1
227
67845
5
use Test2::V0;
7
1
1
1
2218
10568
37
use HTTP::Request::Common;
8
1
1
1
459
535
26
use Plack::Test;
9
1
1
1
168
2
2
use Yukki::Test;
10
1
1
1
319
1
1115
use URI;
11
12
1
47975
yukki_setup;
13
1
79
yukki_add_user(
14    username => 'bob',
15    password => 'bob', # Too cliche?
16    fullname => 'Bob Bobson',
17    email    => 'bob@example.com',
18    groups   => [ 'bob', 'bobdog' ],
19);
20
21
1
13
yukki_git_init('yukki');
22
1
17
yukki_git_init('main');
23
24
1
518
my $app = require "bin/yukki.psgi";
25
1
2554
ok $app, 'got an app';
26
1
2531
is ref $app, 'CODE', 'got a code';
27
28test_psgi
29    app => $app,
30    client => sub {
31
1
6690
        my $cb = shift;
32
33
1
9
        my $res = $cb->(GET "/");
34
1
3425
        like $res->content, qr{Yukki software}, 'got something back';
35
36
1
756
        $res = $cb->(POST "/login/submit", [
37            login_name => 'bob',
38            password   => 'bob',
39        ]);
40
41
1
1140
        is $res->code, 302, 'got main wiki redirect';
42
1
393
        my $loc = URI->new($res->header('Location'));
43
1
94
        is $loc->path, '/page/view/main', 'redirect goes where we expect';
44
45
1
282
        $res = $cb->(GET "/page/view/main");
46
47
1
3669
        like $res->content, qr{<title class="main-title">Main - Yukki</title>}, 'got to the main wiki page';
48
1
448
    };
49
50
1
947
done_testing;