Cleanup in Post tests. Set skipNotification to prevent emails from being queued during the tests.

This commit is contained in:
Colin Kuskie 2009-05-20 03:29:17 +00:00
parent 1ad192fe57
commit 558fba2f6a
2 changed files with 22 additions and 19 deletions

View file

@ -43,10 +43,11 @@ my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Collab setup"}); $versionTag->set({name=>"Collab setup"});
# Need to create a Collaboration system in which the post lives. # Need to create a Collaboration system in which the post lives.
my $collab = $node->addChild({className => 'WebGUI::Asset::Wobject::Collaboration', editTimeout => '1'}); my @addArgs = ( undef, undef, { skipAutoCommitWorkflows => 1, skipNotification => 1 } );
my $collab = $node->addChild({className => 'WebGUI::Asset::Wobject::Collaboration', editTimeout => '1'}, @addArgs);
# The Collaboration system must be committed before a post can be made. # The Collaboration system must be committed before a post can be made.
$versionTag->commit();
# Need to do $post->canEdit tests, which test group membership. Therefore, # Need to do $post->canEdit tests, which test group membership. Therefore,
# create three users and a group for the process. One user will be doing the # create three users and a group for the process. One user will be doing the
@ -63,6 +64,7 @@ my $groupIdEditGroup = WebGUI::Group->new($session, $collab->get('groupIdEdit
WebGUI::Test->usersToDelete($postingUser, $otherUser, $groupIdEditUser); WebGUI::Test->usersToDelete($postingUser, $otherUser, $groupIdEditUser);
$postingUser->username('userForPosting'); $postingUser->username('userForPosting');
$otherUser->username('otherUser'); $otherUser->username('otherUser');
WebGUI::Test->groupsToDelete($groupToEditPost, $groupIdEditGroup);
# Add the posting user to the group allowd to post. # Add the posting user to the group allowd to post.
$postingUser->addToGroups([$collab->get('postGroupId')]); $postingUser->addToGroups([$collab->get('postGroupId')]);
@ -86,7 +88,10 @@ my $props = {
content => 'hello, world!', content => 'hello, world!',
}; };
my $post = $collab->addChild($props); my $post = $collab->addChild($props, @addArgs);
$versionTag->commit();
WebGUI::Test->tagsToRollback($versionTag);
# Test for a sane object type # Test for a sane object type
isa_ok($post, 'WebGUI::Asset::Post::Thread'); isa_ok($post, 'WebGUI::Asset::Post::Thread');
@ -116,8 +121,6 @@ TODO: {
} }
END { END {
# Clean up after thyself
$versionTag->rollback();
} }

View file

@ -72,25 +72,25 @@ $post = WebGUI::Asset->newByDynamicClass( $session, $post->getId );
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Tests # Tests
plan tests => 0; plan tests => 12;
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Permissions for posts # Permissions for posts
# View # View
#$maker->prepare( { $maker->prepare( {
# object => $post, object => $post,
# method => 'canView', method => 'canView',
# pass => [ '1', $user{"2"}, '3', ], pass => [ '1', $user{"2"}, '3', ],
#} )->run; } )->run;
#
## Edit ## Edit
#$maker->prepare( { $maker->prepare( {
# object => $post, object => $post,
# method => 'canEdit', method => 'canEdit',
# pass => [ $user{"2"}, '3', ], pass => [ $user{"2"}, '3', ],
# fail => [ '1', ], fail => [ '1', ],
#} )->run; } )->run;
#
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Cleanup # Cleanup
END { END {