Test to verify addEmailAddress returns a valid id.

This commit is contained in:
Bradley M. Kuhn 2015-12-11 18:23:24 -08:00
parent 5b07fe6af9
commit 9e2359ed72
2 changed files with 8 additions and 3 deletions

View file

@ -168,6 +168,8 @@ Arguments:
=back
Returns the id value of the email_address entry.
=cut
sub addEmailAddress($$$$) {

View file

@ -5,7 +5,7 @@
use strict;
use warnings;
use Test::More tests => 21;
use Test::More tests => 23;
use Test::Exception;
use Scalar::Util qw(looks_like_number);
@ -79,8 +79,11 @@ dies_ok { $sp->addEmailAddress(undef, 'drapper@example.org', 'paypal'); }
dies_ok { $sp->addEmailAddress("String", 'drapper@example.org', 'paypal'); }
"addEmailAddress: dies for non-numeric id";
ok($sp->addEmailAddress($drapperId, 'drapper@example.org', 'work'),
"addEmailAddress: simple add test");
my $drapperEmailId;
lives_ok { $drapperEmailId = $sp->addEmailAddress($drapperId, 'drapper@example.org', 'work') }
"addEmailAdress: inserting a valid email address works";
ok((looks_like_number($drapperEmailId) and $drapperEmailId > 0), "addEmailAddress: id returned is sane.");
=item addAddressType