products/CPSSubscriptions

changeset 1077:deb568c9e36a CPS-3.5

#2464: oops should have tested anonymous, too
author Georges Racinet on purity.racinet.fr <georges@racinet.fr>
date Mon, 17 Oct 2011 13:13:55 +0200
parents b72ee2dec53e
children adfd807f4dbd
files RecipientsRules.py tests/testRecipientsRules.py
diffstat 2 files changed, 18 insertions(+), 1 deletions(-) [+]
line diff
     1.1 --- a/RecipientsRules.py
     1.2 +++ b/RecipientsRules.py
     1.3 @@ -89,7 +89,7 @@
     1.4          if group_id == 'role:Authenticated':
     1.5              return validate(acl_users.email_for_authenticated)
     1.6          elif group_id == 'role:Anonymous':
     1.7 -            return validatel(acl_users.email_for_anonymous)
     1.8 +            return validate(acl_users.email_for_anonymous)
     1.9          elif group_id.startswith('role:'):
    1.10              raise KeyError(group_id)
    1.11  
     2.1 --- a/tests/testRecipientsRules.py
     2.2 +++ b/tests/testRecipientsRules.py
     2.3 @@ -576,6 +576,23 @@
     2.4                                         expand_groups=False)
     2.5          self.assertEquals(recipients, ({}, {}))
     2.6  
     2.7 +        # role:anoymous
     2.8 +        rrr.acl_users.email_for_anonymous = 'anon@cps.example'
     2.9 +
    2.10 +        rrr.portal_membership.getMergedLocalRoles = lambda _: {
    2.11 +            'group:role:Anonymous': ('FakeRole',),
    2.12 +        }
    2.13 +        recipients = rrr.getRecipients('fake_event', container, infos={},
    2.14 +                                       expand_groups=False)
    2.15 +        self.assertEquals(recipients,
    2.16 +                          ({}, {'anon@cps.example': 'role:Anonymous'}))
    2.17 +
    2.18 +        # Again with no address specified
    2.19 +        rrr.acl_users.email_for_anonymous = ''
    2.20 +        recipients = rrr.getRecipients('fake_event', container, infos={},
    2.21 +                                       expand_groups=False)
    2.22 +        self.assertEquals(recipients, ({}, {}))
    2.23 +
    2.24          # Just the user
    2.25          rrr.portal_membership.getMergedLocalRoles = lambda _: {
    2.26              'user:manager': ('FakeRole',),