Provide a way for WebGUI::Test to register groups to clean up at

the end of a test.
Convert several tests to use that, including Post.t, which leaked Groups.
This commit is contained in:
Colin Kuskie 2009-04-13 02:45:03 +00:00
parent 0cbe0cc117
commit ddd06c2ede
4 changed files with 35 additions and 6 deletions

View file

@ -63,12 +63,14 @@ $testGroups{'canEdit asset'} = WebGUI::Group->new($session, 'new');
$testUsers{'canEdit group user'} = WebGUI::User->new($session, 'new');
$testUsers{'canEdit group user'}->addToGroups([$testGroups{'canEdit asset'}->getId]);
$testUsers{'canEdit group user'}->username('Edit Group User');
WebGUI::Test->groupsToDelete($testGroups{'canEdit asset'});
##A group and user for groupIdEdit
$testGroups{'canAdd asset'} = WebGUI::Group->new($session, 'new');
$testUsers{'canAdd group user'} = WebGUI::User->new($session, 'new');
$testUsers{'canAdd group user'}->addToGroups([$testGroups{'canAdd asset'}->getId]);
$testUsers{'canEdit group user'}->username('Can Add Group User');
WebGUI::Test->groupsToDelete($testGroups{'canAdd asset'});
my $canAddMaker = WebGUI::Test::Maker::Permission->new();
$canAddMaker->prepare({
@ -819,9 +821,6 @@ END {
foreach my $user (values %testUsers) {
$user->delete;
}
foreach my $group (values %testUsers) {
$group->delete;
}
}
##Return an array of hashrefs. Each hashref describes a test

View file

@ -60,6 +60,7 @@ 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'));
WebGUI::Test->groupsToDelete($groupToEditPost, $groupIdEditGroup);
$postingUser->username('userForPosting');
$otherUser->username('otherUser');