From: Tara L Andrews Date: Mon, 7 Oct 2013 22:47:59 +0000 (+0200) Subject: add test that demonstrates breakage with user deletion X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4ac3ff0ba484e7d6c3e35107fb1f75928624e0d8;p=scpubgit%2Fstemmatology.git add test that demonstrates breakage with user deletion --- diff --git a/persistence/lib/Text/Tradition/Directory.pm b/persistence/lib/Text/Tradition/Directory.pm index dade1fe..24fe5ae 100644 --- a/persistence/lib/Text/Tradition/Directory.pm +++ b/persistence/lib/Text/Tradition/Directory.pm @@ -118,6 +118,7 @@ my $file = $fh->filename; $fh->close; my $dsn = "dbi:SQLite:dbname=$file"; my $uuid; +my $user = 'user@example.org'; my $t = Text::Tradition->new( 'name' => 'inline', 'input' => 'Tabular', @@ -134,6 +135,12 @@ my $stemma_enabled = $t->can( 'add_stemma' ); $uuid = $d->save( $t ); ok( $uuid, "Saved test tradition" ); + # Add a test user + my $user = $d->add_user({ username => $user, password => 'UserPass' }); + $user->add_tradition( $t ); + $d->store( $user ); + is( $t->user, $user, "Assigned tradition to test user" ); + SKIP: { skip "Analysis package not installed", 5 unless $stemma_enabled; my $s = $t->add_stemma( dotfile => 't/data/simple.dot' ); @@ -193,9 +200,7 @@ ok( $nt->$_isa('Text::Tradition'), "Made new tradition" ); is( scalar $f->traditionlist, 1, "Object is deleted from index" ); } -TODO: { - todo_skip "Deletion conflicts with Analysis package", 2 - if $t->does('Text::Tradition::HasStemma'); +{ my $g = Text::Tradition::Directory->new( 'dsn' => $dsn ); my $scope = $g->new_scope; is( scalar $g->traditionlist, 1, "Now one object in new directory index" ); diff --git a/persistence/t/text_tradition_directory.t b/persistence/t/text_tradition_directory.t index d5ed0b2..bbf8ce0 100644 --- a/persistence/t/text_tradition_directory.t +++ b/persistence/t/text_tradition_directory.t @@ -19,6 +19,7 @@ my $file = $fh->filename; $fh->close; my $dsn = "dbi:SQLite:dbname=$file"; my $uuid; +my $user = 'user@example.org'; my $t = Text::Tradition->new( 'name' => 'inline', 'input' => 'Tabular', @@ -35,6 +36,12 @@ my $stemma_enabled = $t->can( 'add_stemma' ); $uuid = $d->save( $t ); ok( $uuid, "Saved test tradition" ); + # Add a test user + my $user = $d->add_user({ username => $user, password => 'UserPass' }); + $user->add_tradition( $t ); + $d->store( $user ); + is( $t->user, $user, "Assigned tradition to test user" ); + SKIP: { skip "Analysis package not installed", 5 unless $stemma_enabled; my $s = $t->add_stemma( dotfile => 't/data/simple.dot' ); @@ -94,9 +101,7 @@ ok( $nt->$_isa('Text::Tradition'), "Made new tradition" ); is( scalar $f->traditionlist, 1, "Object is deleted from index" ); } -TODO: { - todo_skip "Deletion conflicts with Analysis package", 2 - if $t->does('Text::Tradition::HasStemma'); +{ my $g = Text::Tradition::Directory->new( 'dsn' => $dsn ); my $scope = $g->new_scope; is( scalar $g->traditionlist, 1, "Now one object in new directory index" );