aboutsummaryrefslogtreecommitdiffstats
path: root/t/cobrand
diff options
context:
space:
mode:
Diffstat (limited to 't/cobrand')
-rw-r--r--t/cobrand/bromley.t2
-rw-r--r--t/cobrand/councils.t24
-rw-r--r--t/cobrand/isleofwight.t6
-rw-r--r--t/cobrand/zurich.t2
4 files changed, 29 insertions, 5 deletions
diff --git a/t/cobrand/bromley.t b/t/cobrand/bromley.t
index 3ab1f6150..02ec8750e 100644
--- a/t/cobrand/bromley.t
+++ b/t/cobrand/bromley.t
@@ -169,7 +169,7 @@ for my $test (
like $body, qr/This update will be sent to Bromley Council/i, "Email indicates problem will be sent to Bromley";
unlike $body, qr/Note that we do not send updates to/i, "Email does not say updates aren't sent to Bromley";
- my $unreg_user = FixMyStreet::App->model( 'DB::User' )->find( { email => 'unregistered@example.com' } );
+ my $unreg_user = FixMyStreet::DB->resultset('User')->find( { email => 'unregistered@example.com' } );
ok $unreg_user, 'found user';
diff --git a/t/cobrand/councils.t b/t/cobrand/councils.t
index a194a9be1..aac682b19 100644
--- a/t/cobrand/councils.t
+++ b/t/cobrand/councils.t
@@ -90,5 +90,29 @@ subtest "Test update shown/not shown appropriately" => sub {
}
};
+subtest "CSP header from feature" => sub {
+ foreach my $cobrand (
+ { moniker => 'oxfordshire', test => 'oxon.analytics.example.org' },
+ { moniker =>'fixmystreet', test => '' },
+ { moniker => 'nonsecure', test => undef },
+ ) {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => $cobrand->{moniker},
+ COBRAND_FEATURES => {
+ content_security_policy => {
+ oxfordshire => 'oxon.analytics.example.org',
+ fixmystreet => 1,
+ }
+ },
+ }, sub {
+ $mech->get_ok("/");
+ if (defined $cobrand->{test}) {
+ like $mech->res->header('Content-Security-Policy'), qr/script-src 'self' 'unsafe-inline' 'nonce-[^']*' $cobrand->{test}/;
+ } else {
+ is $mech->res->header('Content-Security-Policy'), undef;
+ }
+ };
+ }
+};
done_testing();
diff --git a/t/cobrand/isleofwight.t b/t/cobrand/isleofwight.t
index f945dc924..1d22eb517 100644
--- a/t/cobrand/isleofwight.t
+++ b/t/cobrand/isleofwight.t
@@ -254,7 +254,7 @@ subtest "fixing passes along the correct message" => sub {
my ($p) = $mech->create_problems_for_body(1, $isleofwight->id, 'Title', { external_id => 1 });
- my $c = FixMyStreet::App->model('DB::Comment')->create({
+ my $c = FixMyStreet::DB->resultset('Comment')->create({
problem => $p, user => $p->user, anonymous => 't', text => 'Update text',
problem_state => 'fixed - council', state => 'confirmed', mark_fixed => 0,
confirmed => DateTime->now(),
@@ -371,7 +371,7 @@ subtest "comment recording triage details is not sent" => sub {
};
my ($p) = $mech->create_problems_for_body(1, $isleofwight->id, '', { cobrand => 'isleofwight' });
-my $alert = FixMyStreet::App->model('DB::Alert')->create( {
+my $alert = FixMyStreet::DB->resultset('Alert')->create( {
parameter => $p->id,
alert_type => 'new_updates',
user => $user,
@@ -412,7 +412,7 @@ subtest "check not responsible as correct text" => sub {
external_id => 1,
});
- my $c = FixMyStreet::App->model('DB::Comment')->create({
+ my $c = FixMyStreet::DB->resultset('Comment')->create({
problem => $p, user => $p->user, anonymous => 't', text => 'Update text',
problem_state => 'not responsible', state => 'confirmed', mark_fixed => 0,
confirmed => DateTime->now(),
diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t
index a08eb431e..6825caccf 100644
--- a/t/cobrand/zurich.t
+++ b/t/cobrand/zurich.t
@@ -834,7 +834,7 @@ subtest "problems can't be assigned to deleted bodies" => sub {
};
subtest "photo must be supplied for categories that require it" => sub {
- FixMyStreet::App->model('DB::Contact')->find_or_create({
+ FixMyStreet::DB->resultset('Contact')->find_or_create({
body => $division,
category => "Graffiti - photo required",
email => "graffiti\@example.org",