From 8876808aecc6d78c61de225b77d5412cb2fc838c Mon Sep 17 00:00:00 2001 From: "Bradley M. Kuhn" Date: Thu, 17 Dec 2015 20:15:09 -0800 Subject: [PATCH] Corrected some tests for _getOrCreateRequestType() --- Supporters/t/Supporters.t | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Supporters/t/Supporters.t b/Supporters/t/Supporters.t index a1a3177..a0a3012 100644 --- a/Supporters/t/Supporters.t +++ b/Supporters/t/Supporters.t @@ -388,6 +388,9 @@ ok(not ($sp->_verifyId($drapperId + 10)), "_verifyId: non-existent id is not fou dies_ok { $sp->_getOrCreateRequestType({ }); } "_getOrCreateRequestType: dies on empty hash"; +dies_ok { $sp->_getOrCreateRequestType({ requestTypeId => "NoStringsPlease" }); } + "_getOrCreateRequestType: dies for string request id"; + dies_ok { $sp->_getOrCreateRequestType({ requestTypeId => 0 }); } "_getOrCreateRequestType: dies for non-existant requestTypeId"; @@ -396,7 +399,7 @@ lives_ok { $sp->_getOrCreateRequestType(\%hh); } "_getOrCreateRequestType: succeeds with just requestType"; my $rr; -lives_ok { $rr = $sp->getRequest("test-request"); } +lives_ok { $rr = $sp->getRequestType("test-request"); } "_getOrCreateRequestType: lookup of a request works after _getOrCreateRequestType"; is_deeply(\%hh, { requestTypeId => $rr }, @@ -404,6 +407,9 @@ is_deeply(\%hh, { requestTypeId => $rr }, %hh = ( requestTypeId => $rr, requestType => 'this-arg-matters-not' ); +lives_ok { $sp->_getOrCreateRequestType(\%hh); } + "_getOrCreateRequestType: lookup of existing requestType suceeds."; + is_deeply(\%hh, { requestTypeId => $rr }, "_getOrCreateRequestType: deletes requestType if both are provided.");