Ejemplo n.º 1
0
 def test_isOwnerUnauthenticated(self):
     """
     L{CalDAVResource.isOwner} returns C{False} for unauthenticated requests.
     """
     site = None
     request = SimpleRequest(site, "GET", "/not/a/real/url/")
     request.authzUser = request.authnUser = None
     rsrc = CalDAVResource()
     rsrc.owner = lambda igreq: HRef("/somebody/")
     self.assertEquals((yield rsrc.isOwner(request)), False)
Ejemplo n.º 2
0
 def test_isOwnerUnauthenticated(self):
     """
     L{CalDAVResource.isOwner} returns C{False} for unauthenticated requests.
     """
     site = None
     request = SimpleRequest(site, "GET", "/not/a/real/url/")
     request.authzUser = request.authnUser = None
     rsrc = CalDAVResource()
     rsrc.owner = lambda igreq: HRef("/somebody/")
     self.assertEquals((yield rsrc.isOwner(request)), False)
Ejemplo n.º 3
0
 def test_isOwnerYes(self):
     """
     L{CalDAVResource.isOwner} returns C{True} for authenticated requests
     with a principal that matches the resource's owner.
     """
     site = None
     request = SimpleRequest(site, "GET", "/not/a/real/url/")
     request.authzUser = request.authnUser = StubPrincipal("/yes-i-am-the-owner/")
     rsrc = CalDAVResource()
     rsrc.owner = lambda igreq: HRef("/yes-i-am-the-owner/")
     self.assertEquals((yield rsrc.isOwner(request)), True)
Ejemplo n.º 4
0
 def test_isOwnerYes(self):
     """
     L{CalDAVResource.isOwner} returns C{True} for authenticated requests
     with a principal that matches the resource's owner.
     """
     site = None
     request = SimpleRequest(site, "GET", "/not/a/real/url/")
     request.authzUser = request.authnUser = StubPrincipal("/yes-i-am-the-owner/")
     rsrc = CalDAVResource()
     rsrc.owner = lambda igreq: HRef("/yes-i-am-the-owner/")
     self.assertEquals((yield rsrc.isOwner(request)), True)
Ejemplo n.º 5
0
 def test_isOwnerReadPrincipal(self):
     """
     L{CalDAVResource.isOwner} returns C{True} for authenticated requests
     with a principal that matches any principal configured in the
     L{AdminPrincipals} list.
     """
     theAdmin = "/read-only-admin/"
     self.patch(config, "ReadPrincipals", [theAdmin])
     site = None
     request = SimpleRequest(site, "GET", "/not/a/real/url/")
     request.authzUser = request.authnUser = StubPrincipal(theAdmin)
     rsrc = CalDAVResource()
     rsrc.owner = lambda igreq: HRef("/some-other-user/")
     self.assertEquals((yield rsrc.isOwner(request)), True)
Ejemplo n.º 6
0
 def test_isOwnerReadPrincipal(self):
     """
     L{CalDAVResource.isOwner} returns C{True} for authenticated requests
     with a principal that matches any principal configured in the
     L{AdminPrincipals} list.
     """
     theAdmin = "/read-only-admin/"
     self.patch(config, "ReadPrincipals", [theAdmin])
     site = None
     request = SimpleRequest(site, "GET", "/not/a/real/url/")
     request.authzUser = request.authnUser = StubPrincipal(theAdmin)
     rsrc = CalDAVResource()
     rsrc.owner = lambda igreq: HRef("/some-other-user/")
     self.assertEquals((yield rsrc.isOwner(request)), True)