X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=script%2Fmaketestdb.pl;h=f26659db0c78682dc3da55dd0931f4a839944892;hb=fbb4eba95e854ade8db07b9bb3204c50039ee234;hp=db1b1e8e7d50624f0cf8b88d8dc233c643f89621;hpb=2c514a6fa0b3eed98e8f978a4b1fa24eb7a7457f;p=scpubgit%2Fstemmaweb.git diff --git a/script/maketestdb.pl b/script/maketestdb.pl index db1b1e8..f26659d 100755 --- a/script/maketestdb.pl +++ b/script/maketestdb.pl @@ -9,7 +9,13 @@ use Text::Tradition::Directory; my $DBDIR = 'db'; my $DBNAME = 'traditions.db'; my $DBEXT = 'test'; -# Delete the old directory if it exists +# Make the directory on the filesystem if necessary +unless( -d $DBDIR ) { + mkdir $DBDIR + or die "Could not make database director $DBDIR"; + say "Created directory for test database"; +} +# Delete the old db if it exists if( -f "$DBDIR/$DBNAME.$DBEXT" ) { unlink( "$DBDIR/$DBNAME.$DBEXT" ); } @@ -28,19 +34,24 @@ my $dir = Text::Tradition::Directory->new( extra_args => { create => 1 } ); my $scope = $dir->new_scope(); -say "Created test directory"; +say "Created test database"; # Create users my $user = $dir->add_user({ username => 'user@example.org', password => 'UserPass' }); my $admin = $dir->add_user({ username => 'admin@example.org', password => 'AdminPass', role => 'admin' }); -die "Failed to create test users" unless $user && $admin; +my $openid_user = $dir->add_user({ + username => 'https://www.google.com/accounts/o8/id?id=AItOawlFTlpuHGcI67tqahtw7xOod9VNWffB-Qg', + password => 'pass' + }); +die "Failed to create test users" unless $user && $admin && $openid_user; say "Created users"; my $t1 = Text::Tradition->new( input => 'Self', file => 't/data/besoin.xml' ); die "Failed to create test tradition #1" unless $t1; $t1->add_stemma( dotfile => 't/data/besoin_stemweb.dot' ); $user->add_tradition( $t1 ); +$openid_user->add_tradition($t1); $dir->store( $user ); say "Created test user tradition"; @@ -56,7 +67,6 @@ $t3->name( 'John verse' ); $dir->store( $t3 ); my $t4 = Text::Tradition->new( input => 'Self', file => 't/data/collatecorr.xml' ); $t4->public( 1 ); -$t4->set_stemweb_jobid( '16' ); $user->add_tradition( $t4 ); $dir->store( $t4 ); $dir->store( $user );