aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller
diff options
context:
space:
mode:
authorM Somerville <matthew-github@dracos.co.uk>2020-09-21 09:10:58 +0100
committerM Somerville <matthew-github@dracos.co.uk>2020-09-25 13:28:14 +0100
commit85a6b7df9bd0b1711637b39d5a63ed6434686b33 (patch)
tree3a96fd0c05bfc47a642b23317a01275b6a8ab173 /t/app/controller
parenta38ecfbe4c5e5741f902eab498a83857500ea8cc (diff)
If text auth on, ask which method they wish to use
Diffstat (limited to 't/app/controller')
-rw-r--r--t/app/controller/report_new_text.t49
1 files changed, 36 insertions, 13 deletions
diff --git a/t/app/controller/report_new_text.t b/t/app/controller/report_new_text.t
index 852cdac76..9256a00de 100644
--- a/t/app/controller/report_new_text.t
+++ b/t/app/controller/report_new_text.t
@@ -15,17 +15,43 @@ $mech->create_contact_ok( body_id => $body->id, category => 'Street lighting', e
$mech->create_contact_ok( body_id => $body->id, category => 'Trees', email => 'trees@example.com' );
# test that phone number validation works okay
+my %defaults = (
+ title => 'Title', detail => 'Detail', name => 'Bob Jones',
+ category => 'Street lighting', may_show_name => 1,
+ photo1 => '', photo2 => '', photo3 => '',
+ password_register => '', password_sign_in => '',
+);
foreach my $test (
{
+ msg => 'missing update method',
+ pc => 'EH1 1BB',
+ fields => {
+ update_method => undef, phone => '', email => '',
+ %defaults,
+ },
+ changes => {
+ username => '',
+ },
+ errors => [ 'Please enter your email', 'Please pick your update preference' ],
+ },
+ {
+ msg => 'email method',
+ pc => 'EH1 1BB',
+ fields => {
+ update_method => 'email', phone => '', email => 'bademail',
+ %defaults,
+ },
+ changes => {
+ username => 'bademail',
+ },
+ errors => [ 'Please enter a valid email' ],
+ },
+ {
msg => 'invalid number',
pc => 'EH1 1BB',
fields => {
- username => '0121 4960000000', email => '', phone => '',
- title => 'Title', detail => 'Detail', name => 'Bob Jones',
- category => 'Street lighting',
- may_show_name => '1',
- photo1 => '', photo2 => '', photo3 => '',
- password_register => '', password_sign_in => '',
+ update_method => 'phone', phone => '0121 4960000000', email => '',
+ %defaults,
},
changes => {
username => '01214960000000',
@@ -37,12 +63,8 @@ foreach my $test (
msg => 'landline number',
pc => 'EH1 1BB',
fields => {
- username => '0121 4960000', email => '', phone => '',
- title => 'Title', detail => 'Detail', name => 'Bob Jones',
- category => 'Street lighting',
- may_show_name => '1',
- photo1 => '', photo2 => '', photo3 => '',
- password_register => '', password_sign_in => '',
+ update_method => 'phone', phone => '0121 4960000', email => '',
+ %defaults,
},
changes => {
username => '0121 496 0000',
@@ -142,7 +164,8 @@ foreach my $test (
title => 'Test Report', detail => 'Test report details.',
photo1 => '',
name => 'Joe Bloggs', may_show_name => '1',
- username => $test_phone,
+ update_method => 'phone',
+ phone => $test_phone,
category => 'Street lighting',
password_register => $test->{password} ? 'secret' : '',
}