aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2019-07-23 12:28:28 +0100
committerDave Arter <davea@mysociety.org>2019-08-16 14:25:12 +0100
commit1165ca9c88ef65fc46a911cd770d71236f4f2b35 (patch)
tree32b2d66c7c29ae3a3c4a344da8c11eac0e835376 /t/app/controller
parentfba6d0112c68267baa56f8760878dd8dccb4b2d8 (diff)
[Westminster] Store user CRM ID when logging in via MyWestminster
Diffstat (limited to 't/app/controller')
-rw-r--r--t/app/controller/auth_social.t23
1 files changed, 23 insertions, 0 deletions
diff --git a/t/app/controller/auth_social.t b/t/app/controller/auth_social.t
index 0f092b480..6c80c9857 100644
--- a/t/app/controller/auth_social.t
+++ b/t/app/controller/auth_social.t
@@ -74,6 +74,9 @@ for my $test (
error_callback => '/auth/OIDC?error=ERROR',
success_callback => '/auth/OIDC?code=response-code',
redirect_pattern => qr{oidc\.example\.org/oauth2/v2\.0/authorize},
+ user_extras => [
+ [westminster_account_id => "1c304134-ef12-c128-9212-123908123901"],
+ ],
}
) {
@@ -194,13 +197,33 @@ for my $state ( 'refused', 'no email', 'existing UID', 'okay' ) {
} elsif ($test->{type} eq 'oidc') {
is_deeply $user->oidc_ids, [ $test->{uid} ], 'User now has correct OIDC IDs';
}
+ if ($test->{user_extras}) {
+ for my $extra (@{ $test->{user_extras} }) {
+ my ($k, $v) = @$extra;
+ is $user->get_extra_metadata($k), $v, "User has correct $k extra field";
+ }
+ }
} elsif ($page ne 'my') {
# /my auth login goes directly there, no message like this
$mech->content_contains('You have successfully signed in; please check and confirm your details are accurate');
$mech->logged_in_ok;
+ if ($test->{user_extras}) {
+ my $user = FixMyStreet::App->model( 'DB::User' )->find( { email => $test->{email} } );
+ for my $extra (@{ $test->{user_extras} }) {
+ my ($k, $v) = @$extra;
+ is $user->get_extra_metadata($k), $v, "User has correct $k extra field";
+ }
+ }
} else {
is $mech->uri->path, '/my', 'Successfully on /my page';
+ if ($test->{user_extras}) {
+ my $user = FixMyStreet::App->model( 'DB::User' )->find( { email => $test->{email} } );
+ for my $extra (@{ $test->{user_extras} }) {
+ my ($k, $v) = @$extra;
+ is $user->get_extra_metadata($k), $v, "User has correct $k extra field";
+ }
+ }
}
}
}