commit 493363821d52a13e1bfe50fdc2b7ba36c22ee022
parent 9f529769c558889dd81c0747cc4d47831257139e
Author: kyle <kyle@0x30.net>
Date: Sun, 10 Jan 2016 15:09:44 -0700
tests: update device_add test
- this catches the test up with the previous client.pm change
Diffstat:
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/server/tests/device_add/server.log.good b/server/tests/device_add/server.log.good
@@ -4,4 +4,5 @@ ssl ok, ver = 'TLSv1_2' cipher = 'ECDHE-RSA-AES128-SHA256'
device_add: success, <digits>:<base64> os <base64>
device_add: phone number '403867530&' invalid
device_add: phone number <digits> already exists
+device_add: unknown operating system <base64>
disconnected!
diff --git a/server/tests/device_add/test.pl b/server/tests/device_add/test.pl
@@ -6,10 +6,8 @@ use client;
use test;
my $A = client->new();
-
# basic sanity check on the device_add message type
-my $phnum = rand_phnum();
-$A->device_add($phnum);
+$A->device_add(my $phnum = rand_phnum());
my $devid = $A->device_id();
my $length = length($devid);
@@ -17,9 +15,13 @@ fail "device id '$devid' not base64" unless ($devid =~ m/^[a-zA-Z0-9+\/=]+$/);
fail "expected device id length of 43, got $length" if ($length != 43);
# try adding a device with a bad phone number
-$A->device_add('403867530&', 'err');
+$A->device_add('403867530&', 'unix', 'err');
fail_msg_ne 'the sent phone number is not a number', $A->get_error();
# try adding the same phone number again
-$A->device_add($phnum, 'err');
+$A->device_add($phnum, 'unix', 'err');
fail_msg_ne 'the sent phone number already exists', $A->get_error();
+
+# send device_add with a bad operating system type
+$A->device_add(rand_phnum(), 'bados', 'err');
+fail_msg_ne 'operating system not supported', $A->get_error();