You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@roller.apache.org by Shing Wai Chan <Sh...@Sun.COM> on 2007/09/22 00:09:42 UTC

PermissionTest.testPermissionsLookups

Hi,

While looking at 
org.apache.roller.weblogger.business.PermissionTest.testPermissionsLookups(),
I have a question.
The scenario is as follows:
    mgr.grantWeblogPermission(testWeblog, user, actions);
    ....
    perms = mgr.getWeblogPermissionsPending(TestUtils.getManagedUser(user));
    assertEquals(1, perms.size());

Does the above test fail?
It is because grantWeblogPermission should create a permission with 
pending = false
according to current implementation.

There are many ways to fix it. The following are some alternatives:
1. change to grantWeblogPermissionPending
2. or change to getWeblogPermissions
3. or change to assertEquals(0, perms.size())

Regards,
      Shing Wai Chan

Re: PermissionTest.testPermissionsLookups

Posted by Dave <sn...@gmail.com>.
On 9/21/07, Shing Wai Chan <Sh...@sun.com> wrote:
> Hi,
>
> While looking at
> org.apache.roller.weblogger.business.PermissionTest.testPermissionsLookups(),
> I have a question.
> The scenario is as follows:
>     mgr.grantWeblogPermission(testWeblog, user, actions);
>     ....
>     perms = mgr.getWeblogPermissionsPending(TestUtils.getManagedUser(user));
>     assertEquals(1, perms.size());
>
> Does the above test fail?
> It is because grantWeblogPermission should create a permission with
> pending = false
> according to current implementation.
>
> There are many ways to fix it. The following are some alternatives:
> 1. change to grantWeblogPermissionPending
> 2. or change to getWeblogPermissions
> 3. or change to assertEquals(0, perms.size())

I just committed a fix for this:
http://svn.apache.org/viewvc?rev=579655&view=rev

In the original tests before the latest changes to permissions method
signature, we were granting a pending permission. I fixed the test to
behave as they did before.

- Dave