zero_payload.t (656B)
1 use strict; 2 use Test; 3 use SL::Test; 4 5 BEGIN { plan tests => 24 } 6 7 # Create new device, turn off automatic device_add 8 my $s = SL::Test::Server->new(); 9 my $A = SL::Test::Client->new(1); 10 11 # Send size zero payload to all message types 12 for ( $A->msg_str() ) { 13 my $msg_good = 'a missing message argument was required'; 14 my $log_good = "/bad request, missing key 'device_id'/"; 15 if ($_ eq 'device_add') { 16 $msg_good = 'the sent phone number is not a number'; 17 $log_good = "/phone number invalid/"; 18 } 19 20 # Send empty dictionary 21 $A->send_msg($_, {} ); 22 my $response = $A->recv_msg($_); 23 ok( $response->{reason}, $msg_good ); 24 ok( $s->readline(), $log_good ); 25 }