10 use Text::Tradition::Directory;
12 my $newt = Text::Tradition->new( 'input' => 'Self',
13 'file' => 't/data/florilegium_graphml.xml' );
15 my $fh = File::Temp->new();
16 my $file = $fh->filename;
18 my $dsn = "dbi:SQLite:dbname=$file";
19 my $userstore = Text::Tradition::Directory->new( { dsn => $dsn,
20 extra_args => { create => 1 } } );
21 my $scope = $userstore->new_scope();
22 my $testuser = $userstore->create_user( { url => 'http://example.com' } );
23 ok( $testuser->$_isa('Text::Tradition::User'), "Created test user via userstore" );
24 $testuser->add_tradition( $newt );
25 is( $newt->user->id, $testuser->id, "Assigned tradition to test user" );
26 my $graphml_str = $newt->collation->as_graphml;
29 $usert = Text::Tradition->new( 'input' => 'Self', 'string' => $graphml_str );
30 } 'DROPPING user assignment without a specified userstore',
31 "Got expected user drop warning on parse";
32 $usert = Text::Tradition->new( 'input' => 'Self', 'string' => $graphml_str,
33 'userstore' => $userstore );
34 is( $usert->user->id, $testuser->id, "Parsed tradition with userstore points to correct user" );