Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adjust testing of PgPir driver (not working yet)
- Loading branch information
Martin Berends
committed
Jul 1, 2010
1 parent
84a45aa
commit db65fed
Showing
5 changed files
with
104 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# MiniDBI/t/30-PgPir-common.t | ||
use v6; | ||
use Test; | ||
use MiniDBI; | ||
|
||
# Define the only database specific values used by the common tests. | ||
my ( $mdriver, $test_dsn, $test_user, $test_password ); | ||
{ | ||
# Define values that are relevant only to MySQL | ||
my $hostname = 'localhost'; | ||
my $database = 'zavolaj'; | ||
# Set up the common variables with the MySQL specific values | ||
$mdriver = 'PgPir'; | ||
$test_dsn = "MiniDBI:$mdriver" ~ ":database=$database;" | ||
~ "host=$hostname"; | ||
$test_user = 'testuser'; | ||
$test_password = 'testpass'; | ||
} | ||
|
||
# Detect and report possible errors from eval of the common test script | ||
warn $! if "ok 99-common.pl6" ne eval slurp 't/99-common.pl6'; | ||
|
||
=begin pod | ||
=head1 PREREQUISITES | ||
Your system should already have libpq-dev installed. Change to the | ||
postgres user and connect to the postgres server as follows: | ||
sudo -u postgres psql | ||
Then set up a test environment with the following: | ||
CREATE DATABASE zavolaj; | ||
CREATE ROLE testuser LOGIN PASSWORD 'testpass'; | ||
GRANT ALL PRIVILEGES ON DATABASE zavolaj TO testuser; | ||
The '\l' psql command output should include zavolaj as a database name. | ||
Exit the psql client with a ^D, then try to use the new account: | ||
psql --host=localhost --dbname=zavolaj --username=testuser --password | ||
SELECT * FROM pg_database; | ||
=end pod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
use v6; | ||
use Test; | ||
plan *; | ||
|
||
use MiniDBI; | ||
|
||
my $mdriver = 'PgPir'; | ||
my $host = 'localhost'; | ||
my $port = 5432; | ||
my $database = 'testdb'; | ||
my $user = 'testuser'; | ||
my $password = 'testpass'; | ||
# my $password = 'Cho5thae'; | ||
|
||
my $test_dsn = "FakeDBI:{$mdriver}:dbname=$database;host=$host;port=$port"; | ||
|
||
my $drh = MiniDBI.install_driver($mdriver); | ||
ok $drh, 'Install driver'; | ||
|
||
my $dbh; | ||
lives_ok { $dbh = MiniDBI.connect($test_dsn, $user, $password, | ||
RaiseError => 1, PrintError => 1, AutoCommit => 1) }, | ||
'Connecting lives'; | ||
|
||
ok defined($dbh), 'DBH is defined'; | ||
ok $dbh, 'DBH is true'; | ||
# lives_ok { $dbh.finish }, 'Can finish DBH'; | ||
#nok $dbh, 'finished DBH is false'; | ||
|
||
|
||
done_testing; | ||
|
||
=begin pod | ||
=head1 PREREQUISITES | ||
Your system should already have libpq-dev installed. Change to the | ||
postgres user and connect to the postgres server as follows: | ||
sudo -u postgres psql | ||
Then set up a test environment with the following: | ||
CREATE DATABASE testdb; | ||
CREATE ROLE testuser LOGIN PASSWORD 'testpass'; | ||
GRANT ALL PRIVILEGES ON DATABASE testdb TO testuser; | ||
The '\l' psql command output should include testdb as a database name. | ||
Exit the psql client with a ^D, then try to use the new account: | ||
psql --host=localhost --dbname=testdb --username=testuser --password | ||
SELECT * FROM pg_database; | ||
=end pod |
This file was deleted.
Oops, something went wrong.