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