LP#1481036 Ignore future backdates live test
authorBill Erickson <berickxx@gmail.com>
Wed, 5 Aug 2015 21:41:51 +0000 (17:41 -0400)
committerBen Shum <bshum@biblio.org>
Wed, 19 Aug 2015 02:39:24 +0000 (22:39 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/src/perlmods/live_t/10-lp1481036-future-backdate.t [new file with mode: 0644]

diff --git a/Open-ILS/src/perlmods/live_t/10-lp1481036-future-backdate.t b/Open-ILS/src/perlmods/live_t/10-lp1481036-future-backdate.t
new file mode 100644 (file)
index 0000000..a249093
--- /dev/null
@@ -0,0 +1,36 @@
+#!perl
+use strict; use warnings;
+
+use Test::More tests => 3;
+
+diag("Tests handling of future backdates in checkin");
+
+use constant ITEM_BARCODE => 'CONC4000070';
+
+use DateTime;
+use OpenILS::Utils::TestUtils;
+my $script = OpenILS::Utils::TestUtils->new();
+$script->bootstrap;
+
+$script->authenticate({
+    username => 'admin',
+    password => 'demo123',
+    type => 'staff'
+});
+
+ok($script->authtoken, 'Have an authtoken');
+
+my $checkin_resp = $script->do_checkin({
+    barcode => ITEM_BARCODE,
+    backdate => '3001-01-23' # date of the singularity; it is known.
+});
+
+is(ref $checkin_resp,'HASH','Checkin request returned a HASH');
+
+my $ymd = DateTime->now->strftime('%F');
+
+ok(
+    substr($checkin_resp->{payload}->{circ}->checkin_time, 0, 10) eq $ymd,
+    'Checkin time matches current date, not backdate'
+);
+