Cleanup in Post tests. Set skipNotification to prevent emails from being queued during the tests.
This commit is contained in:
parent
1ad192fe57
commit
558fba2f6a
2 changed files with 22 additions and 19 deletions
|
|
@ -43,10 +43,11 @@ my $versionTag = WebGUI::VersionTag->getWorking($session);
|
|||
$versionTag->set({name=>"Collab setup"});
|
||||
|
||||
# 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.
|
||||
$versionTag->commit();
|
||||
|
||||
# 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
|
||||
|
|
@ -63,6 +64,7 @@ my $groupIdEditGroup = WebGUI::Group->new($session, $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')]);
|
||||
|
|
@ -86,7 +88,10 @@ my $props = {
|
|||
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
|
||||
isa_ok($post, 'WebGUI::Asset::Post::Thread');
|
||||
|
|
@ -116,8 +121,6 @@ TODO: {
|
|||
}
|
||||
|
||||
END {
|
||||
# Clean up after thyself
|
||||
$versionTag->rollback();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -72,25 +72,25 @@ $post = WebGUI::Asset->newByDynamicClass( $session, $post->getId );
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
plan tests => 0;
|
||||
plan tests => 12;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Permissions for posts
|
||||
# View
|
||||
#$maker->prepare( {
|
||||
# object => $post,
|
||||
# method => 'canView',
|
||||
# pass => [ '1', $user{"2"}, '3', ],
|
||||
#} )->run;
|
||||
#
|
||||
$maker->prepare( {
|
||||
object => $post,
|
||||
method => 'canView',
|
||||
pass => [ '1', $user{"2"}, '3', ],
|
||||
} )->run;
|
||||
|
||||
## Edit
|
||||
#$maker->prepare( {
|
||||
# object => $post,
|
||||
# method => 'canEdit',
|
||||
# pass => [ $user{"2"}, '3', ],
|
||||
# fail => [ '1', ],
|
||||
#} )->run;
|
||||
#
|
||||
$maker->prepare( {
|
||||
object => $post,
|
||||
method => 'canEdit',
|
||||
pass => [ $user{"2"}, '3', ],
|
||||
fail => [ '1', ],
|
||||
} )->run;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Cleanup
|
||||
END {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue