LP#1240119 safe auth activity live test
authorBill Erickson <berickxx@gmail.com>
Wed, 19 Aug 2015 15:08:48 +0000 (11:08 -0400)
committerJason Stephenson <jstephenson@mvlc.org>
Wed, 19 Aug 2015 18:43:47 +0000 (14:43 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Open-ILS/src/perlmods/live_t/11-lp1240119-safe-token-activity.t [new file with mode: 0644]

diff --git a/Open-ILS/src/perlmods/live_t/11-lp1240119-safe-token-activity.t b/Open-ILS/src/perlmods/live_t/11-lp1240119-safe-token-activity.t
new file mode 100644 (file)
index 0000000..9909450
--- /dev/null
@@ -0,0 +1,43 @@
+#!perl
+use strict; use warnings;
+use Test::More tests => 4;
+use OpenILS::Utils::TestUtils;
+use OpenILS::Utils::CStoreEditor qw/:funcs/;
+
+diag("Tests safe auth token user activity tracking");
+
+my $script = OpenILS::Utils::TestUtils->new();
+$script->bootstrap;
+
+my $e = new_editor();
+$e->init;
+
+$script->authenticate({
+    username => 'admin',
+    password => 'demo123',
+    type => 'staff'
+});
+
+ok($script->authtoken, 'Have an authtoken');
+
+my $actor_ses = $script->session('open-ils.actor');
+my $req = $actor_ses->request(
+    'open-ils.actor.session.safe_token', $script->authtoken);
+
+my $safe_token = $req->recv->content;
+
+ok($safe_token, 'Have safe token');
+
+my $act_count = scalar(@{$e->search_actor_usr_activity({usr => 1})});
+
+$req = $actor_ses->request(
+    'open-ils.actor.safe_token.home_lib.shortname', $safe_token);
+
+my $home_ou = $req->recv->content;
+
+ok($home_ou, 'Retrieved home org unit');
+
+my $act_count2 = scalar(@{$e->search_actor_usr_activity({usr => 1})});
+
+is($act_count2, $act_count + 1, 'User activity entry created');
+