aboutsummaryrefslogtreecommitdiffstats
path: root/t/cobrand/councils.t
blob: c44605bd9c497dbac39d0430f15249c885e59c75 (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
use FixMyStreet::TestMech;
my $mech = FixMyStreet::TestMech->new;

my $oxon = $mech->create_body_ok(2237, 'Oxfordshire County Council' );
my $contact = $mech->create_contact_ok( body_id => $oxon->id, category => 'Cows', email => 'cows@example.net' );

my ($report) = $mech->create_problems_for_body(1, $oxon->id, 'Test', {
    category => 'Cows', cobrand => 'fixmystreet',
});
my $report_id = $report->id;


foreach my $council (qw/oxfordshire bromley/) {
    FixMyStreet::override_config {
        ALLOWED_COBRANDS => [ $council ],
    }, sub {
        ok $mech->host("$council.fixmystreet.com"), "change host to $council";
        $mech->get_ok('/');
        $mech->content_like( qr/\u$council/ );
    };
}


foreach my $test (
    { cobrand => 'fixmystreet', social => 1 },
    { cobrand => 'bromley', social => 0 },
) {

    FixMyStreet::override_config {
        ALLOWED_COBRANDS => [ $test->{cobrand} ],
        FACEBOOK_APP_ID => 'facebook-app-id',
        TWITTER_KEY => 'twitter-key',
        MAPIT_URL => 'http://mapit.uk/',
    }, sub {
        $mech->get_ok('/auth');
        $mech->contains_or_lacks($test->{social}, "Log in with Facebook");
        $mech->contains_or_lacks($test->{social}, "Log in with Twitter");

        $mech->get_ok("/report/new?lat=51.754926&lon=-1.256179");
        $mech->contains_or_lacks($test->{social}, "Log in with Facebook");
        $mech->contains_or_lacks($test->{social}, "Log in with Twitter");

        $mech->get_ok("/report/$report_id");
        $mech->contains_or_lacks($test->{social}, "Log in with Facebook");
        $mech->contains_or_lacks($test->{social}, "Log in with Twitter");
    };
};


done_testing();