[BlueBream] What I did not setup?

Taras voyn1991 at gmail.com
Thu Sep 29 11:48:40 EST 2011


Hi
I am testing some security issues and written the test as such:
import zope.configuration.xmlconfig
import flats.security
class TestStatusCodes(unittest.TestCase):
    
    def test_authenticated(self):
        zope.configuration.xmlconfig.file("ftesting.zcml", flats.security)

        request = TestRequest()
        request.setPrincipal(principalRegistry.getPrincipal("flats.owner"))
        newInteraction(request)
        interaction = getInteraction()
        for permission in ["flats.flat.Add",
                          ]:
                
            self.assertTrue(interaction.checkPermission("flats.user.user.Add",
                            ProxyFactory(object())), permission)

And the zcml as such:
<configure
   xmlns="http://namespaces.zope.org/zope"
   i18n_domain="flats">

  <!-- This file contains sample security policy definition -->

  <include package="zope.securitypolicy" file="meta.zcml" />

  <include package="zope.app.zcmlfiles" />
  <include package="zope.securitypolicy" />

  <securityPolicy 
     component="zope.securitypolicy.zopepolicy.ZopeSecurityPolicy" />

  <unauthenticatedPrincipal
     id="zope.anybody"
     title="Unauthenticated User" />

  <unauthenticatedGroup
     id="zope.Anybody"
     title="Unauthenticated Users" />

  <authenticatedGroup
     id="zope.Authenticated"
     title="Authenticated Users" />

  <everybodyGroup
     id="zope.Everybody"
     title="All Users" />

    <permission id="flats.flat.Add" title="Flat Add"/>
	<role id="flats.Owner" title="Owner of the resource" />
  	<grant permission="flats.flat.Add" role="flats.Owner" />

	<principal
		id="flats.owner"
		title="Owner"
		login="owner"
		password="owner"
		/>

	<grant
		role="flats.Owner"
		principal="flats.owner" />

</configure>

The test fails. I simply can't get what did I do wrong… I defined the permission, role, principal. Did all grants. Included security policy. Started interaction. What is missing?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/bluebream/attachments/20110929/e5143ed3/attachment.html 


More information about the bluebream mailing list