test cleanups

This commit is contained in:
Graham Knop 2009-09-23 10:27:23 -05:00
parent 79a544d4ae
commit 328f3dfcec
8 changed files with 590 additions and 455 deletions

View file

@ -59,23 +59,22 @@ my $collab = $node->addChild({className => 'WebGUI::Asset::Wobject::Collaboratio
my $postingUser = WebGUI::User->new($session, 'new');
my $otherUser = WebGUI::User->new($session, 'new');
my $groupIdEditUser = WebGUI::User->new($session, 'new');
my $groupToEditPost = WebGUI::Group->new($session, $collab->get('groupToEditPost'));
my $groupIdEditGroup = WebGUI::Group->new($session, $collab->get('groupIdEdit'));
my $groupToEditPostId = $collab->get('groupToEditPost');
my $groupIdEdit = $collab->get('groupIdEdit');
WebGUI::Test->usersToDelete($postingUser, $otherUser, $groupIdEditUser);
$postingUser->username('userForPosting');
$otherUser->username('otherUser');
WebGUI::Test->groupsToDelete($groupToEditPost, $groupIdEditGroup);
# Add the posting user to the group allowd to post.
$postingUser->addToGroups([$collab->get('postGroupId')]);
# Add $otherUser to $groupToEditPost so that they can edit the posts after the
# timeout has expired.
$otherUser->addToGroups([$groupToEditPost->getId]);
$otherUser->addToGroups([$groupToEditPostId]);
# Similarly, add $groupIdEditUser to $groupIdEditGroup so that they, too, can
# edit posts after the timeout has expired.
$groupIdEditUser->addToGroups([$groupIdEditGroup->getId]);
$groupIdEditUser->addToGroups([$groupIdEdit]);
# We need to become $postingUser to ensure that the canEdit tests below use
# $postingUser's credentials rather than the default user assigned to the

View file

@ -34,6 +34,7 @@ WebGUI::Test->usersToDelete($user{'2'});
$user{"2"}->addToGroups( ['2'] ); # Registered user
my $versionTag = WebGUI::VersionTag->getWorking( $session );
WebGUI::Test->tagsToRollback($versionTag);
$versionTag->set( { name => "Collaboration Test" } );
my @addArgs = ( undef, undef, { skipAutoCommitWorkflows => 1, skipNotification => 1 } );
@ -120,10 +121,5 @@ $maker->prepare( {
} )->run;
$thread->unlock;
#----------------------------------------------------------------------------
# Cleanup
END {
my $subscriptionGroup = WebGUI::Group->new($session, $thread->get('subscriptionGroupId'));
WebGUI::Test->groupsToDelete($subscriptionGroup);
$versionTag->rollback;
}
WebGUI::Test->addToCleanup('WebGUI::Group' => $thread->get('subscriptionGroupId'));

View file

@ -35,6 +35,7 @@ $user{"2"}->addToGroups( ['2'] ); # Registered user
my $versionTag = WebGUI::VersionTag->getWorking( $session );
$versionTag->set( { name => "Collaboration Test" } );
WebGUI::Test->tagsToRollback($versionTag);
my @addArgs = ( undef, undef, { skipAutoCommitWorkflows => 1, skipNotification => 1 } );
@ -93,8 +94,5 @@ $maker->prepare( {
#----------------------------------------------------------------------------
# Cleanup
END {
my $subscriptionGroup = WebGUI::Group->new($session, $thread->get('subscriptionGroupId'));
WebGUI::Test->groupsToDelete($subscriptionGroup);
$versionTag->rollback;
}
WebGUI::Test->addToCleanup('WebGUI::Group' => $thread->get('subscriptionGroupId'));