File: 60reauth.t

package info (click to toggle)
libdbd-oracle-perl 1.44-1
  • links: PTS, VCS
  • area: contrib
  • in suites: wheezy
  • size: 1,844 kB
  • sloc: ansic: 8,114; perl: 7,435; makefile: 21
file content (37 lines) | stat: -rw-r--r-- 914 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!perl -w
use Test::More;

use DBI;
unshift @INC ,'t';
require 'nchar_test_lib.pl';

$| = 1;

my $dbuser = $ENV{ORACLE_USERID} || 'scott/tiger';
my $dbuser_2 = $ENV{ORACLE_USERID_2} || '';

if ($dbuser_2 eq '') {
    plan skip_all => "ORACLE_USERID_2 not defined.\n";
}
# strip off @ on userid_2, as the reauth presumes current server
$dbuser_2 =~ s/@.*//;
(my $uid1 = uc $dbuser) =~ s:/.*::;
(my $uid2 = uc $dbuser_2) =~ s:/.*::;
if ($uid1 eq $uid2) {
    plan skip_all => "ORACLE_USERID_2 not unique.\n";
}

my $dsn = oracle_test_dsn();
my $dbh = DBI->connect($dsn, $dbuser, '');

if ($dbh) {
    plan tests => 3;
} else {
    plan skip_all => "Unable to connect to Oracle\n";
}

is(($dbh->selectrow_array("SELECT USER FROM DUAL"))[0], $uid1, 'uid1' );
ok($dbh->func($dbuser_2, '', 'reauthenticate'), 'reauthenticate');
is(($dbh->selectrow_array("SELECT USER FROM DUAL"))[0], $uid2, 'uid2' );

$dbh->disconnect;