aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/token.t
diff options
context:
space:
mode:
Diffstat (limited to 't/app/controller/token.t')
-rw-r--r--t/app/controller/token.t35
1 files changed, 35 insertions, 0 deletions
diff --git a/t/app/controller/token.t b/t/app/controller/token.t
new file mode 100644
index 000000000..ac88f4f7a
--- /dev/null
+++ b/t/app/controller/token.t
@@ -0,0 +1,35 @@
+use strict;
+use warnings;
+use Test::More;
+use utf8;
+
+use FixMyStreet::TestMech;
+use FixMyStreet::App;
+
+my $mech = FixMyStreet::TestMech->new;
+my $user = $mech->create_user_ok('bob@example.com', name => 'Bob');
+
+subtest 'Zurich special case for C::Tokens->problem_confirm' => sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => ['zurich'],
+ }, sub {
+ my $c = FixMyStreet::App->new;
+ my $zurich = $mech->create_body_ok( 1, 'Zurich' );
+ my ($report) = $mech->create_problems_for_body(
+ 1, $zurich->id,
+ {
+ state => 'unconfirmed',
+ confirmed => undef,
+ cobrand => 'zurich',
+ });
+
+ is $report->get_extra_metadata('email_confirmed'), undef, 'email_confirmed not yet set (sanity)';
+ my $token = $c->model('DB::Token')->create({ scope => 'problem', data => $report->id });
+
+ $mech->get_ok('/P/' . $token->token);
+ $report->discard_changes;
+ is $report->get_extra_metadata('email_confirmed'), 1, 'email_confirmed set by Zurich special case';
+ };
+};
+
+done_testing;