diff options
author | Dave Arter <davea@mysociety.org> | 2019-08-06 12:13:44 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2019-08-16 14:25:12 +0100 |
commit | f06c4f89a218e568de5df27ab62bd49042958c59 (patch) | |
tree | b2b48246a789d587665b8dc61ee6f33d7ff36e04 /t/app/controller | |
parent | ef3706c69bbc0a9063570d29bdd615e531fa5a46 (diff) |
Add test for viewing existing reports when using social sign-in
Diffstat (limited to 't/app/controller')
-rw-r--r-- | t/app/controller/auth_social.t | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/t/app/controller/auth_social.t b/t/app/controller/auth_social.t index 86aa92022..160d46f8f 100644 --- a/t/app/controller/auth_social.t +++ b/t/app/controller/auth_social.t @@ -16,7 +16,7 @@ END { FixMyStreet::App->log->enable('info'); } my $body = $mech->create_body_ok(2504, 'Westminster Council'); -my ($report) = $mech->create_problems_for_body(1, $body->id, 'Test'); +my ($report) = $mech->create_problems_for_body(1, $body->id, 'My Test Report'); my $contact = $mech->create_contact_ok( body_id => $body->id, category => 'Damaged bin', email => 'BIN', @@ -108,6 +108,11 @@ for my $state ( 'refused', 'no email', 'existing UID', 'okay' ) { } else { $mech->delete_user($test->{email}); } + if ($page eq 'my' && $state eq 'existing UID') { + $report->update({ user_id => FixMyStreet::App->model( 'DB::User' )->find( { email => $test->{email} } )->id }); + } else { + $report->update({ user_id => FixMyStreet::App->model( 'DB::User' )->find( { email => 'test@example.com' } )->id }); + } # Set up a mock to catch (most, see below) requests to the OAuth API my $mock_api = $test->{mock}->new; @@ -231,6 +236,11 @@ for my $state ( 'refused', 'no email', 'existing UID', 'okay' ) { is $user->get_extra_metadata($k), $v, "User has correct $k extra field"; } } + if ($state eq 'existing UID') { + my $report_id = $report->id; + $mech->content_contains( $report->title ); + $mech->content_contains( "/report/$report_id" ); + } } $mech->get('/auth/sign_out'); |