aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/about.t
blob: 04d902bc5c436d6f625563314ed616a8e47003ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package FixMyStreet::Cobrand::Tester;
use parent 'FixMyStreet::Cobrand::Default';
sub path_to_web_templates { [ FixMyStreet->path_to( 't', 'app', 'controller', 'templates') ] }

package main;

use FixMyStreet::TestMech;

ok( my $mech = FixMyStreet::TestMech->new, 'Created mech object' );

# check that we can get the page
$mech->get_ok('/faq');
$mech->content_like(qr{Frequently Asked Questions ::\s+FixMyStreet});
$mech->content_contains('html class="no-js" lang="en-gb"');

$mech->get_ok('/privacy');
is $mech->res->code, 200, "got 200 for final destination";
is $mech->res->previous->code, 302, "got 302 for redirect";
is $mech->uri->path, '/about/privacy';

$mech->get('/about/page-that-does-not-exist');
ok !$mech->res->is_success(), "want a bad response";
is $mech->res->code, 404, "got 404";

FixMyStreet::override_config {
    ALLOWED_COBRANDS => [ 'fiksgatami' ],
}, sub {
    ok $mech->host("www.fiksgatami.no"), 'host to fiksgatami';
    $mech->get_ok('/faq');
    $mech->content_like(qr{Ofte spurte spørsmål ::});
    $mech->content_contains('html class="no-js" lang="nb"');
};

$mech->get_ok('/');
$mech->content_contains('Report a problem');
$mech->content_lacks('STATIC FRONT PAGE');
$mech->get('/report');
is $mech->res->code, 200, "got 200";
is $mech->res->previous->code, 302, "got 302 for redirect";
is $mech->uri->path, '/', 'redirected to front page';

FixMyStreet::override_config {
    ALLOWED_COBRANDS => [ 'tester' ],
}, sub {
    $mech->get_ok('/');
    $mech->content_contains('STATIC FRONT PAGE');
    $mech->get_ok('/report');
    is $mech->res->previous, undef, 'No redirect';
    $mech->content_contains('Report a problem');
};

done_testing();