]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/perlmods/live_t/01-auth.t
Add a TestUtils library for live tests
[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, full-auto install by
14 # eg_wheezy_installer.sh, etc.
15 #----------------------------------------------------------------
16
17 $script->authenticate({
18     username => 'admin',
19     password => 'demo123',
20     type => 'staff'});
21
22 my $authtoken = $script->authtoken;
23
24 ok(
25     $authtoken,
26     'Have an authtoken'
27 );
28 is(
29     $script->authtime,
30     7200,
31     'Default authtime for staff login is 7200 seconds'
32 );
33
34 my $cached_obj = $script->cache()->get_cache("oils_auth_$authtoken");
35
36 ok(
37     ref $cached_obj,
38     'Can retrieve authtoken from memcached'
39 );
40
41 $script->logout();
42
43 $cached_obj = $script->cache()->get_cache("oils_auth_$authtoken");
44 ok(
45     ! $cached_obj,
46     'Authtoken is removed from memcached after logout'
47 );
48