From: Tara L Andrews Date: Tue, 11 Sep 2012 19:33:58 +0000 (+0200) Subject: fix TODO statuses in tests X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=836e05464e23a7804a34d74a605b3e721135c085;p=scpubgit%2Fstemmatology.git fix TODO statuses in tests --- diff --git a/lib/Text/Tradition/Stemma.pm b/lib/Text/Tradition/Stemma.pm index 9411a3f..a0f2060 100644 --- a/lib/Text/Tradition/Stemma.pm +++ b/lib/Text/Tradition/Stemma.pm @@ -97,13 +97,16 @@ use TryCatch; use_ok( 'Text::Tradition::Stemma' ); # Try to create a bad graph -my $baddotfh; -open( $baddotfh, 't/data/besoin_bad.dot' ) or die "Could not open test dotfile"; -try { - my $stemma = Text::Tradition::Stemma->new( dot => $baddotfh ); - ok( 0, "Created broken stemma from dotfile with syntax error" ); -} catch( Text::Tradition::Error $e ) { - like( $e->message, qr/^Error trying to parse/, "Syntax error in dot threw exception" ); +TODO: { + local $TODO = "cannot use stdout redirection trick with FastCGI"; + my $baddotfh; + open( $baddotfh, 't/data/besoin_bad.dot' ) or die "Could not open test dotfile"; + try { + my $stemma = Text::Tradition::Stemma->new( dot => $baddotfh ); + ok( 0, "Created broken stemma from dotfile with syntax error" ); + } catch( Text::Tradition::Error $e ) { + like( $e->message, qr/^Error trying to parse/, "Syntax error in dot threw exception" ); + } } # Create a good graph diff --git a/t/text_tradition_stemma.t b/t/text_tradition_stemma.t index 63b834c..d41b388 100644 --- a/t/text_tradition_stemma.t +++ b/t/text_tradition_stemma.t @@ -13,13 +13,16 @@ use TryCatch; use_ok( 'Text::Tradition::Stemma' ); # Try to create a bad graph -my $baddotfh; -open( $baddotfh, 't/data/besoin_bad.dot' ) or die "Could not open test dotfile"; -try { - my $stemma = Text::Tradition::Stemma->new( dot => $baddotfh ); - ok( 0, "Created broken stemma from dotfile with syntax error" ); -} catch( Text::Tradition::Error $e ) { - like( $e->message, qr/^Error trying to parse/, "Syntax error in dot threw exception" ); +TODO: { + local $TODO = "cannot use stdout redirection trick with FastCGI"; + my $baddotfh; + open( $baddotfh, 't/data/besoin_bad.dot' ) or die "Could not open test dotfile"; + try { + my $stemma = Text::Tradition::Stemma->new( dot => $baddotfh ); + ok( 0, "Created broken stemma from dotfile with syntax error" ); + } catch( Text::Tradition::Error $e ) { + like( $e->message, qr/^Error trying to parse/, "Syntax error in dot threw exception" ); + } } # Create a good graph diff --git a/t/text_tradition_user.t b/t/text_tradition_user.t index a401ebe..bcaa171 100644 --- a/t/text_tradition_user.t +++ b/t/text_tradition_user.t @@ -132,40 +132,37 @@ ok($changed->check_password('passbloggs'), 'Modified & retrieved with correct ne } -TODO: { - local $TODO = 'searching on public attr not implemented yet'; - ## Fetch public traditions, not user traditions, when not fetching with a user - use Text::Tradition; - my $t = Text::Tradition->new( - 'name' => 'inline', - 'input' => 'Tabular', - 'file' => 't/data/simple.txt', - ); +## Fetch public traditions, not user traditions, when not fetching with a user +use Text::Tradition; +my $t = Text::Tradition->new( + 'name' => 'inline', + 'input' => 'Tabular', + 'file' => 't/data/simple.txt', +); + +$user_store->save($t); +my $user = $user_store->add_user({ username => 'testpublic', + password => 'testingtraditions' }); +$user->add_tradition($t); +$user_store->update($user); + +## add a second, not owned by this user, we shouldn't return it from +## traditionslist +my $t2 = Text::Tradition->new( + 'name' => 'inline', + 'input' => 'Tabular', + 'file' => 't/data/simple.txt', +); +$t2->public(1); +my $uuid = $user_store->save($t2); + +my @tlist = $user_store->traditionlist('public'); +is(scalar @tlist, 1, 'Got one public tradition'); +is($tlist[0]->{name}, $t2->name, 'Traditionlist returns same named user->tradition'); +is($tlist[0]->{id}, $uuid, 'Traditionlist returns actual tradition with same uuid we put in earlier'); +my $fetched_t = $user_store->tradition($tlist[0]->{id}); +ok($fetched_t->public, 'Traditionlist returns public item'); - $user_store->save($t); - my $user = $user_store->add_user({ username => 'testpublic', - password => 'testingtraditions' }); - $user->add_tradition($t); - $user_store->update($user); - - ## add a second, not owned by this user, we shouldn't return it from - ## traditionslist - my $t2 = Text::Tradition->new( - 'name' => 'inline', - 'input' => 'Tabular', - 'file' => 't/data/simple.txt', - ); - $t2->public(1); - my $uuid = $user_store->save($t2); - - my @tlist = $user_store->traditionlist('public'); - is(scalar @tlist, 1, 'Got one public tradition'); - is($tlist[0]->{name}, $t2->name, 'Traditionlist returns same named user->tradition'); - is($tlist[0]->{id}, $uuid, 'Traditionlist returns actual tradition with same uuid we put in earlier'); - my $fetched_t = $user_store->tradition($tlist[0]->{id}); - ok($fetched_t->public, 'Traditionlist returns public item'); - -} { ## remove_tradition