diff options
Diffstat (limited to 't/app')
-rw-r--r-- | t/app/controller/auth.t | 39 | ||||
-rw-r--r-- | t/app/controller/auth_social.t | 8 |
2 files changed, 15 insertions, 32 deletions
diff --git a/t/app/controller/auth.t b/t/app/controller/auth.t index 8cc7e4154..ffabc75f3 100644 --- a/t/app/controller/auth.t +++ b/t/app/controller/auth.t @@ -100,33 +100,6 @@ $mech->not_logged_in_ok; $mech->log_out_ok; } -foreach my $remember_me ( '1', '0' ) { - subtest "sign in using valid details (remember_me => '$remember_me')" => sub { - $mech->get_ok('/auth'); - $mech->submit_form_ok( - { - form_name => 'general_auth', - fields => { - username => $test_email, - password_sign_in => $test_password, - remember_me => ( $remember_me ? 1 : undef ), - }, - button => 'sign_in_by_password', - }, - "sign in with '$test_email' & '$test_password'" - ); - is $mech->uri->path, '/my', "redirected to correct page"; - - my $expiry = $mech->session_cookie_expiry; - $remember_me - ? cmp_ok( $expiry, '>', 86400, "long expiry time" ) - : is( $expiry, 0, "no expiry time" ); - - # logout - $mech->log_out_ok; - }; -} - # try to sign in with bad details $mech->get_ok('/auth'); $mech->submit_form_ok( @@ -278,7 +251,7 @@ subtest "check logging in with token" => sub { }; subtest 'check password length/common' => sub { - $mech->get_ok('/auth'); + $mech->get_ok('/auth/create'); $mech->submit_form_ok({ form_name => 'general_auth', fields => { username => $test_email, password_register => 'short' }, @@ -300,6 +273,16 @@ subtest 'check common password AJAX call' => sub { $mech->content_contains("true"); }; +subtest 'test forgotten password page' => sub { + $mech->get_ok('/auth/forgot'); + $mech->content_contains('Forgot password'); + $mech->submit_form_ok({ + form_name => 'general_auth', + fields => { username => $test_email, password_register => 'squirblewirble' }, + button => 'sign_in_by_code', + }); +}; + subtest "Test two-factor authentication login" => sub { use Auth::GoogleAuth; my $auth = Auth::GoogleAuth->new; diff --git a/t/app/controller/auth_social.t b/t/app/controller/auth_social.t index 031fb8d9e..ac3d98b15 100644 --- a/t/app/controller/auth_social.t +++ b/t/app/controller/auth_social.t @@ -103,8 +103,8 @@ for my $fb_state ( 'refused', 'no email', 'existing UID', 'okay' ) { # We don't have an email, so check that we can still submit it, # and the ID carries through the confirmation $fields->{username} = $fb_email; - $fields->{name} = 'Ffion Tester'; - $mech->submit_form(with_fields => $fields); + $fields->{name} = 'Ffion Tester' unless $page eq 'my'; + $mech->submit_form(with_fields => $fields, $page eq 'my' ? (button => 'sign_in_by_code') : ()); $mech->content_contains('Nearly done! Now check your email'); my $url = $mech->get_link_from_email; @@ -211,8 +211,8 @@ for my $tw_state ( 'refused', 'existing UID', 'no email' ) { # We don't have an email, so check that we can still submit it, # and the ID carries through the confirmation $fields->{username} = $tw_email; - $fields->{name} = 'Ffion Tester'; - $mech->submit_form(with_fields => $fields); + $fields->{name} = 'Ffion Tester' unless $page eq 'my'; + $mech->submit_form(with_fields => $fields, $page eq 'my' ? (button => 'sign_in_by_code') : ()); $mech->content_contains('Nearly done! Now check your email'); my $url = $mech->get_link_from_email; |