diff options
Diffstat (limited to 't/app')
-rw-r--r-- | t/app/controller/report_new_text.t | 14 | ||||
-rw-r--r-- | t/app/controller/report_update_text.t | 47 |
2 files changed, 39 insertions, 22 deletions
diff --git a/t/app/controller/report_new_text.t b/t/app/controller/report_new_text.t index 8753e7e20..fa012c6ae 100644 --- a/t/app/controller/report_new_text.t +++ b/t/app/controller/report_new_text.t @@ -72,6 +72,19 @@ foreach my $test ( }, errors => [ 'Please enter a mobile number', ], }, + { + msg => 'number that fails', + pc => 'EH1 1BB', + fields => { + update_method => 'phone', phone => '+18165550101', email => '', + %defaults, + }, + changes => { + username => '', + phone => '+1 816-555-0101', + }, + errors => [ 'Sending a confirmation text failed: "Unable to send (21408)"' ], + }, ) { subtest "check form errors where $test->{msg}" => sub { @@ -82,6 +95,7 @@ foreach my $test ( MAPIT_URL => 'http://mapit.uk/', SMS_AUTHENTICATION => 1, PHONE_COUNTRY => 'GB', + TWILIO_ACCOUNT_SID => 'AC123', }, sub { $mech->submit_form_ok( { with_fields => { pc => $test->{pc} } }, "submit location" ); diff --git a/t/app/controller/report_update_text.t b/t/app/controller/report_update_text.t index 3f9a73773..fbf5ca0c6 100644 --- a/t/app/controller/report_update_text.t +++ b/t/app/controller/report_update_text.t @@ -58,22 +58,25 @@ my $comment = FixMyStreet::DB->resultset('Comment')->find_or_create( { my $comment_id = $comment->id; ok $comment, "created test update - $comment_id"; +my %defaults = ( + username => '', + update => 'Update', + name => 'Name', + photo1 => '', + photo2 => '', + photo3 => '', + fixed => undef, + add_alert => 1, + may_show_name => undef, + password_sign_in => '', + password_register => '', +); for my $test ( { desc => 'Invalid phone', fields => { username_register => '01214960000000', - username => '', - update => 'Update', - name => 'Name', - photo1 => '', - photo2 => '', - photo3 => '', - fixed => undef, - add_alert => 1, - may_show_name => undef, - password_sign_in => '', - password_register => '', + %defaults, }, changes => {}, field_errors => [ 'Please check your phone number is correct' ] @@ -82,21 +85,20 @@ for my $test ( desc => 'landline number', fields => { username_register => '01214960000', - username => '', - update => 'Update', - name => 'Name', - photo1 => '', - photo2 => '', - photo3 => '', - fixed => undef, - add_alert => 1, - may_show_name => undef, - password_register => '', - password_sign_in => '', + %defaults, }, changes => {}, field_errors => [ 'Please enter a mobile number' ] }, + { + desc => 'fails to send', + fields => { + username_register => '+18165550101', + %defaults, + }, + changes => {}, + field_errors => [ 'Sending a confirmation text failed: "Unable to send (21408)"' ] + }, ) { subtest "submit an update - $test->{desc}" => sub { @@ -104,6 +106,7 @@ for my $test ( FixMyStreet::override_config { SMS_AUTHENTICATION => 1, + TWILIO_ACCOUNT_SID => 'AC123', PHONE_COUNTRY => 'GB', }, sub { $mech->submit_form_ok( { with_fields => $test->{fields} }, 'submit update' ); |