aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/auth_social.t
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2016-04-22 11:28:51 +0100
committerMatthew Somerville <matthew@mysociety.org>2016-04-22 11:28:51 +0100
commit42ce7397f1a1c0f59a1896d5f62d49ef4fe97b38 (patch)
tree7e9d4a463e949c6f5afbd440be1137a4ee82627a /t/app/controller/auth_social.t
parentf070fb4f6743f69b99362b821d4395e6f99700eb (diff)
Fix Twitter authentication test.
Pull in the same fix that was made in f598f56f for the Facebook tests.
Diffstat (limited to 't/app/controller/auth_social.t')
-rw-r--r--t/app/controller/auth_social.t7
1 files changed, 5 insertions, 2 deletions
diff --git a/t/app/controller/auth_social.t b/t/app/controller/auth_social.t
index bfb6017e2..6929c0ddc 100644
--- a/t/app/controller/auth_social.t
+++ b/t/app/controller/auth_social.t
@@ -147,7 +147,10 @@ my $tw_uid = 987654321;
for my $tw_state ( 'refused', 'existing UID', 'no email' ) {
for my $page ( 'my', 'report', 'update' ) {
subtest "test Twitter '$tw_state' login for page '$page'" => sub {
+ # Lots of user changes happening here, make sure we don't confuse
+ # Catalyst with a cookie session user that no longer exists
$mech->log_out_ok;
+ $mech->cookie_jar({});
if ($tw_state eq 'existing UID') {
my $user = $mech->create_user_ok($tw_email);
$user->update({ twitter_id => $tw_uid });
@@ -155,12 +158,12 @@ for my $tw_state ( 'refused', 'existing UID', 'no email' ) {
$mech->delete_user($tw_email);
}
- # Set up a mock to catch (most, see below) requests to Facebook
+ # Set up a mock to catch (most, see below) requests to Twitter
my $tw = t::Mock::Twitter->new;
LWP::Protocol::PSGI->register($tw->to_psgi_app, host => 'api.twitter.com');
# Due to https://metacpan.org/pod/Test::WWW::Mechanize::Catalyst#External-Redirects-and-allow_external
- # the redirect to Facebook's OAuth page can mess up the session
+ # the redirect to Twitter's OAuth page can mess up the session
# cookie. So let's pretend we always on api.twitter.com, which
# sorts that out.
$mech->host('api.twitter.com');