aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-10-16 12:08:49 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-10-16 12:08:49 +0100
commitd9d2ca67b4feb3f550a432051606fe0df2c3680f (patch)
tree77fafbdf05e7608b98a66f9528b406b2ee0329ec /t/app/controller
parent69cd91b70b488ebba89558cbc41d2472ecbbec5a (diff)
parent8a3072bfdc11121da5a11932c248ab13f6f0d315 (diff)
Merge branch 'sms-mssid-error'
Diffstat (limited to 't/app/controller')
-rw-r--r--t/app/controller/auth_phone.t46
1 files changed, 21 insertions, 25 deletions
diff --git a/t/app/controller/auth_phone.t b/t/app/controller/auth_phone.t
index 435ea7552..dea1c3493 100644
--- a/t/app/controller/auth_phone.t
+++ b/t/app/controller/auth_phone.t
@@ -7,12 +7,13 @@ LWP::Protocol::PSGI->register($twilio->to_psgi_app, host => 'api.twilio.com');
my $mech = FixMyStreet::TestMech->new;
-subtest 'Log in with invalid number, fail' => sub {
- FixMyStreet::override_config {
- SMS_AUTHENTICATION => 1,
- PHONE_COUNTRY => 'GB',
- TWILIO_ACCOUNT_SID => 'AC123',
- }, sub {
+FixMyStreet::override_config {
+ SMS_AUTHENTICATION => 1,
+ PHONE_COUNTRY => 'GB',
+ TWILIO_ACCOUNT_SID => 'AC123',
+}, sub {
+
+ subtest 'Log in with invalid number, fail' => sub {
$mech->get_ok('/auth');
$mech->submit_form_ok({
form_name => 'general_auth',
@@ -21,14 +22,8 @@ subtest 'Log in with invalid number, fail' => sub {
}, "sign in using bad number");
$mech->content_contains('Please check your phone number is correct');
};
-};
-subtest 'Log in using landline, fail' => sub {
- FixMyStreet::override_config {
- SMS_AUTHENTICATION => 1,
- PHONE_COUNTRY => 'GB',
- TWILIO_ACCOUNT_SID => 'AC123',
- }, sub {
+ subtest 'Log in using landline, fail' => sub {
$mech->get_ok('/auth');
$mech->submit_form_ok({
form_name => 'general_auth',
@@ -37,14 +32,18 @@ subtest 'Log in using landline, fail' => sub {
}, "sign in using landline");
$mech->content_contains('Please enter a mobile number');
};
-};
-subtest 'Log in using mobile, by text' => sub {
- FixMyStreet::override_config {
- SMS_AUTHENTICATION => 1,
- PHONE_COUNTRY => 'GB',
- TWILIO_ACCOUNT_SID => 'AC123',
- }, sub {
+ subtest 'Log in using number that fails at Twilio' => sub {
+ $mech->get_ok('/auth');
+ $mech->submit_form_ok({
+ form_name => 'general_auth',
+ fields => { username => '+18165550101' },
+ button => 'sign_in_by_code',
+ }, "sign in using failing number");
+ $mech->content_contains('Sending a confirmation text failed');
+ };
+
+ subtest 'Log in using mobile, by text' => sub {
$mech->submit_form_ok({
form_name => 'general_auth',
fields => { username => '+18165550100', password_register => 'secret' },
@@ -67,12 +66,8 @@ subtest 'Log in using mobile, by text' => sub {
$mech->logged_in_ok;
$mech->log_out_ok;
};
-};
-subtest 'Log in using mobile, by password' => sub {
- FixMyStreet::override_config {
- SMS_AUTHENTICATION => 1,
- }, sub {
+ subtest 'Log in using mobile, by password' => sub {
$mech->get_ok('/auth');
$mech->submit_form_ok({
form_name => 'general_auth',
@@ -89,6 +84,7 @@ subtest 'Log in using mobile, by password' => sub {
is $mech->uri->path, '/my', "redirected to the 'my' section of site";
$mech->logged_in_ok;
};
+
};
done_testing();