diff options
author | Russ Allbery <rra@stanford.edu> | 2007-12-05 01:10:23 +0000 |
---|---|---|
committer | Russ Allbery <rra@stanford.edu> | 2007-12-05 01:10:23 +0000 |
commit | c0c34051887d08a94221f9cbc2b74fbfad34c22c (patch) | |
tree | cf6dbd65beee76296f4a16fef21c86419eaa5ed8 /perl/t | |
parent | 0e9a5e25ec9c1977c6426f4aea4b61a658fe6855 (diff) |
Determine the class for object and ACL schema implementations from the
database rather than a hard-coded list and provide Wallet::Schema
methods for adding new class mappings.
Add a missing class mapping for the netdb ACL schema verifier.
Diffstat (limited to 'perl/t')
-rwxr-xr-x | perl/t/schema.t | 2 | ||||
-rwxr-xr-x | perl/t/server.t | 10 |
2 files changed, 7 insertions, 5 deletions
diff --git a/perl/t/schema.t b/perl/t/schema.t index 1068048..70378de 100755 --- a/perl/t/schema.t +++ b/perl/t/schema.t @@ -21,7 +21,7 @@ ok (defined $schema, 'Wallet::Schema creation'); ok ($schema->isa ('Wallet::Schema'), ' and class verification'); my @sql = $schema->sql; ok (@sql > 0, 'sql() returns something'); -is (scalar (@sql), 26, ' and returns the right number of statements'); +is (scalar (@sql), 28, ' and returns the right number of statements'); # Connect to a database and test create. db_setup; diff --git a/perl/t/server.t b/perl/t/server.t index 229d58d..a1467d1 100755 --- a/perl/t/server.t +++ b/perl/t/server.t @@ -12,14 +12,12 @@ use Test::More tests => 321; use POSIX qw(strftime); use Wallet::Config; +use Wallet::Schema; use Wallet::Server; use lib 't/lib'; use Util; -# Allow creation of base objects for testing purposes. -$Wallet::Server::MAPPING{base} = 'Wallet::Object::Base'; - # Some global defaults to use. my $admin = 'admin@EXAMPLE.COM'; my $user1 = 'alice@EXAMPLE.COM'; @@ -40,6 +38,10 @@ ok ($server->isa ('Wallet::Server'), ' and returned the right class'); my $dbh = $server->dbh; ok (defined ($dbh), ' and returns a defined database handle'); +# Allow creation of base objects for testing purposes. +my $schema = Wallet::Schema->new; +$schema->register_object ($dbh, 'base', 'Wallet::Object::Base'); + # We're currently running as the administrator, so everything should succeed. # Set up a bunch of data for us to test with, starting with some ACLs. Test # the error handling while we're at it. @@ -867,7 +869,7 @@ is ($server->error, "$user2 not authorized to create base:service/foo", ' with the right error'); # Clean up. -my $schema = Wallet::Schema->new; +$schema = Wallet::Schema->new; $schema->drop ($server->dbh); unlink 'wallet-db'; |