]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/perlmods/live_t/01-auth.t
LP#1796945 Reporter cloning and creation fixes
[working/Evergreen.git] / Open-ILS / src / perlmods / live_t / 01-auth.t
1 #!perl
2
3 use Test::More tests => 4;
4
5 diag("Simple tests against the open-ils.auth service, memcached, and the stock test data.");
6
7 use strict; use warnings;
8
9 use OpenILS::Utils::TestUtils;
10 my $script = OpenILS::Utils::TestUtils->new();
11
12 #----------------------------------------------------------------
13 # The tests...  assumes stock sample data
14 #----------------------------------------------------------------
15
16 $script->authenticate({
17     username => 'admin',
18     password => 'demo123',
19     type => 'staff'});
20
21 my $authtoken = $script->authtoken;
22
23 ok(
24     $authtoken,
25     'Have an authtoken'
26 );
27 is(
28     $script->authtime,
29     7200,
30     'Default authtime for staff login is 7200 seconds'
31 );
32
33 my $cached_obj = $script->cache()->get_cache("oils_auth_$authtoken");
34
35 ok(
36     ref $cached_obj,
37     'Can retrieve authtoken from memcached'
38 );
39
40 $script->logout();
41
42 $cached_obj = $script->cache()->get_cache("oils_auth_$authtoken");
43 ok(
44     ! $cached_obj,
45     'Authtoken is removed from memcached after logout'
46 );
47