aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/about.t
blob: 750983f2492cdef3bd930f1cf34566432a38304e (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
use strict;
use warnings;

use Test::More;
use Test::WWW::Mechanize::Catalyst 'FixMyStreet::App';

ok( my $mech = Test::WWW::Mechanize::Catalyst->new, 'Created mech object' );

# check that we can get the page
$mech->get_ok('/about');
$mech->content_like(qr{About us ::\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 => [ 'emptyhomes' ],
}, sub {
    # check that geting the page as EHA produces a different page
    ok $mech->host("reportemptyhomes.co.uk"), 'change host to reportemptyhomes';
    $mech->get_ok('/about');
    $mech->content_like(qr{About us ::});
    $mech->content_contains('html lang="en-gb"');

    # check that geting the page as EHA in welsh produces a different page
    ok $mech->host("cy.reportemptyhomes.co.uk"), 'host to cy.reportemptyhomes';
    $mech->get_ok('/about');
    $mech->content_like(qr{Amdanom ni ::});
    $mech->content_contains('html lang="cy"');
};

done_testing();