当前位置: 首页>>代码示例>>Python>>正文


Python SimpleRequest.locateResource方法代码示例

本文整理汇总了Python中twext.web2.test.test_server.SimpleRequest.locateResource方法的典型用法代码示例。如果您正苦于以下问题:Python SimpleRequest.locateResource方法的具体用法?Python SimpleRequest.locateResource怎么用?Python SimpleRequest.locateResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twext.web2.test.test_server.SimpleRequest的用法示例。


在下文中一共展示了SimpleRequest.locateResource方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_fix_shared_default

# 需要导入模块: from twext.web2.test.test_server import SimpleRequest [as 别名]
# 或者: from twext.web2.test.test_server.SimpleRequest import locateResource [as 别名]
    def test_fix_shared_default(self):
        """
        Make calendar
        """
        

        request = SimpleRequest(self.site, "GET", "/addressbooks/users/wsanchez/")
        home = yield request.locateResource("/addressbooks/users/wsanchez")

        # Create a new default adbk
        newadbk = yield request.locateResource("/addressbooks/__uids__/6423F94A-6B76-4A3A-815B-D52CFD77935D/newadbk/")
        yield newadbk.createAddressBookCollection()
        home.writeDeadProperty(carddavxml.DefaultAddressBookURL(
            HRef("/addressbooks/__uids__/6423F94A-6B76-4A3A-815B-D52CFD77935D/newadbk/")
        ))
        try:
            default = yield home.readProperty(carddavxml.DefaultAddressBookURL, request)
        except HTTPError:
            self.fail("carddavxml.DefaultAddressBookURL is not present")
        else:
            self.assertEqual(str(default.children[0]), "/addressbooks/__uids__/6423F94A-6B76-4A3A-815B-D52CFD77935D/newadbk/")
        
        # Force the new calendar to think it is a sharee collection
        newadbk._isShareeCollection = True
        
        try:
            default = yield home.readProperty(carddavxml.DefaultAddressBookURL, request)
        except HTTPError:
            self.fail("carddavxml.DefaultAddressBookURL is not present")
        else:
            self.assertEqual(str(default.children[0]), "/addressbooks/__uids__/6423F94A-6B76-4A3A-815B-D52CFD77935D/addressbook/")

        request._newStoreTransaction.abort()
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:35,代码来源:test_resource.py

示例2: test_free_busy_set_same

# 需要导入模块: from twext.web2.test.test_server import SimpleRequest [as 别名]
# 或者: from twext.web2.test.test_server.SimpleRequest import locateResource [as 别名]
    def test_free_busy_set_same(self):
        """
        Test that calendar-free-busy-set has the correct value and can be reset to the same.
        """

        request = SimpleRequest(self.site, "GET", "/calendars/users/user01/inbox/")
        inbox = yield request.locateResource("/calendars/users/user01/inbox/")
        self.assertTrue((yield inbox.hasProperty(caldavxml.CalendarFreeBusySet, request)))
        prop = (yield inbox.readProperty(caldavxml.CalendarFreeBusySet, request))
        self.assertEqual(prop.children[0], davxml.HRef("/calendars/__uids__/user01/calendar/"))

        newfbset = set()
        newfbset.add("/calendars/users/user01/calendar/")
        newset = caldavxml.CalendarFreeBusySet(*[davxml.HRef(url) for url in newfbset])

        yield inbox.writeProperty(newset, request)
        yield request._newStoreTransaction.commit()

        request = SimpleRequest(self.site, "GET", "/calendars/users/user01/inbox/")
        inbox = yield request.locateResource("/calendars/users/user01/inbox/")
        prop = (yield inbox.readProperty(caldavxml.CalendarFreeBusySet, request))
        self.assertEqual(prop.children[0], davxml.HRef("/calendars/__uids__/user01/calendar/"))
        yield request._newStoreTransaction.commit()
        calendar = yield request.locateResource("/calendars/__uids__/user01/calendar/")
        self.assertTrue(calendar._newStoreObject.isUsedForFreeBusy())
开发者ID:anemitz,项目名称:calendarserver,代码行数:27,代码来源:test_resource.py

示例3: test_missing_default_vtodo_calendar

# 需要导入模块: from twext.web2.test.test_server import SimpleRequest [as 别名]
# 或者: from twext.web2.test.test_server.SimpleRequest import locateResource [as 别名]
    def test_missing_default_vtodo_calendar(self):
        """
        Test that pickNewDefaultCalendar will create a missing default tasks calendar.
        """

        request = SimpleRequest(self.site, "GET", "/calendars/users/wsanchez/")
        home = yield request.locateResource("/calendars/users/wsanchez/")
        inbox = yield request.locateResource("/calendars/users/wsanchez/inbox")

        # default property initially not present
        try:
            inbox.readDeadProperty(customxml.ScheduleDefaultTasksURL)
        except HTTPError:
            pass
        else:
            self.fail("caldavxml.ScheduleDefaultTasksURL is not empty")

        # Forcibly remove the one we need
        yield home._newStoreHome.removeChildWithName("tasks")
        names = [calendarName for calendarName in (yield home._newStoreHome.listCalendars())]
        self.assertTrue("tasks" not in names)

        yield inbox.pickNewDefaultCalendar(request, tasks=True)

        try:
            default = inbox.readDeadProperty(customxml.ScheduleDefaultTasksURL)
        except HTTPError:
            self.fail("caldavxml.ScheduleDefaultTasksURL is not present")
        else:
            self.assertEqual(str(default.children[0]), "/calendars/__uids__/6423F94A-6B76-4A3A-815B-D52CFD77935D/tasks")

        request._newStoreTransaction.abort()
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:34,代码来源:test_resource.py

示例4: test_fix_shared_default

# 需要导入模块: from twext.web2.test.test_server import SimpleRequest [as 别名]
# 或者: from twext.web2.test.test_server.SimpleRequest import locateResource [as 别名]
    def test_fix_shared_default(self):
        """
        Make calendar
        """

        request = SimpleRequest(self.site, "GET", "/calendars/users/wsanchez/")
        inbox = yield request.locateResource("/calendars/users/wsanchez/inbox")

        # Create a new default calendar
        newcalendar = yield request.locateResource("/calendars/__uids__/6423F94A-6B76-4A3A-815B-D52CFD77935D/newcalendar")
        yield newcalendar.createCalendarCollection()
        inbox.writeDeadProperty(caldavxml.ScheduleDefaultCalendarURL(
            davxml.HRef("/calendars/__uids__/6423F94A-6B76-4A3A-815B-D52CFD77935D/newcalendar")
        ))
        try:
            default = yield inbox.readProperty(caldavxml.ScheduleDefaultCalendarURL, request)
        except HTTPError:
            self.fail("caldavxml.ScheduleDefaultCalendarURL is not present")
        else:
            self.assertEqual(str(default.children[0]), "/calendars/__uids__/6423F94A-6B76-4A3A-815B-D52CFD77935D/newcalendar")

        # Force the new calendar to think it is a virtual share
        newcalendar._isShareeCollection = True

        try:
            default = yield inbox.readProperty(caldavxml.ScheduleDefaultCalendarURL, request)
        except HTTPError:
            self.fail("caldavxml.ScheduleDefaultCalendarURL is not present")
        else:
            self.assertEqual(str(default.children[0]), "/calendars/__uids__/6423F94A-6B76-4A3A-815B-D52CFD77935D/calendar")

        request._newStoreTransaction.abort()
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:34,代码来源:test_resource.py

示例5: test_set_default_vevent_other

# 需要导入模块: from twext.web2.test.test_server import SimpleRequest [as 别名]
# 或者: from twext.web2.test.test_server.SimpleRequest import locateResource [as 别名]
    def test_set_default_vevent_other(self):
        """
        Test that the default URL can be set to another VEVENT calendar
        """

        request = SimpleRequest(self.site, "GET", "/calendars/users/wsanchez/")
        inbox = yield request.locateResource("/calendars/users/wsanchez/inbox")

        # default property not present
        try:
            inbox.readDeadProperty(caldavxml.ScheduleDefaultCalendarURL)
        except HTTPError:
            pass
        else:
            self.fail("caldavxml.ScheduleDefaultCalendarURL is not empty")

        # Create a new default calendar
        newcalendar = yield request.locateResource("/calendars/users/wsanchez/newcalendar")
        yield newcalendar.createCalendarCollection()
        yield newcalendar.setSupportedComponents(("VEVENT",))
        request._newStoreTransaction.commit()

        request = SimpleRequest(self.site, "GET", "/calendars/users/wsanchez/")
        inbox = yield request.locateResource("/calendars/users/wsanchez/inbox")
        yield inbox.writeProperty(caldavxml.ScheduleDefaultCalendarURL(davxml.HRef("/calendars/__uids__/6423F94A-6B76-4A3A-815B-D52CFD77935D/newcalendar")), request)

        try:
            default = inbox.readDeadProperty(caldavxml.ScheduleDefaultCalendarURL)
        except HTTPError:
            self.fail("caldavxml.ScheduleDefaultCalendarURL is not present")
        else:
            self.assertEqual(str(default.children[0]), "/calendars/__uids__/6423F94A-6B76-4A3A-815B-D52CFD77935D/newcalendar")

        request._newStoreTransaction.commit()
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:36,代码来源:test_resource.py

示例6: test_CalendarTranspProperty

# 需要导入模块: from twext.web2.test.test_server import SimpleRequest [as 别名]
# 或者: from twext.web2.test.test_server.SimpleRequest import locateResource [as 别名]
    def test_CalendarTranspProperty(self):

        request = SimpleRequest(self.site, "GET", "/calendars/users/wsanchez/calendar/")

        # Get calendar first
        calendar = (yield request.locateResource("/calendars/users/wsanchez/calendar/"))
        if calendar is None:
            self.fail("Incorrect response to GET on existent calendar.")

        inbox = (yield request.locateResource("/calendars/users/wsanchez/inbox/"))
        if inbox is None:
            self.fail("Incorrect response to GET on existent inbox.")
        
        # Provisioned calendar has default opaque property
        transp = (yield calendar.hasProperty(caldavxml.ScheduleCalendarTransp, request))
        self.assertTrue(transp)

        transp = (yield calendar.readProperty(caldavxml.ScheduleCalendarTransp, request))
        self.assertEqual(transp, caldavxml.ScheduleCalendarTransp(caldavxml.Opaque()))

        # Inbox property lists the default calendar
        fbset = (yield inbox.hasProperty(caldavxml.CalendarFreeBusySet, request))
        self.assertTrue(fbset)

        fbset = (yield inbox.readProperty(caldavxml.CalendarFreeBusySet, request))
        self.assertEqual(fbset, caldavxml.CalendarFreeBusySet(
            davxml.HRef.fromString("/calendars/__uids__/6423F94A-6B76-4A3A-815B-D52CFD77935D/calendar"),
        ))

        # Now remove the dead property to simulate the old calendar server state with
        # a calendar listed in the fbset
        yield calendar.removeDeadProperty(caldavxml.ScheduleCalendarTransp)
        fbset = (yield inbox.readProperty(caldavxml.CalendarFreeBusySet, request))
        self.assertEqual(fbset, caldavxml.CalendarFreeBusySet(
            davxml.HRef.fromString("/calendars/__uids__/6423F94A-6B76-4A3A-815B-D52CFD77935D/calendar"),
        ))

        # Calendar has opaque property derived from inbox
        transp = (yield calendar.hasProperty(caldavxml.ScheduleCalendarTransp, request))
        self.assertTrue(transp)

        transp = (yield calendar.readProperty(caldavxml.ScheduleCalendarTransp, request))
        self.assertEqual(transp, caldavxml.ScheduleCalendarTransp(caldavxml.Opaque()))

        # Now remove the dead property and the inbox fbset item to simulate the old calendar server state
        yield calendar.removeDeadProperty(caldavxml.ScheduleCalendarTransp)
        yield inbox.removeDeadProperty(caldavxml.CalendarFreeBusySet)

        # Calendar has transp property derived from inbox
        transp = (yield calendar.hasProperty(caldavxml.ScheduleCalendarTransp, request))
        self.assertTrue(transp)

        transp = (yield calendar.readProperty(caldavxml.ScheduleCalendarTransp, request))
        self.assertEqual(transp, caldavxml.ScheduleCalendarTransp(caldavxml.Transparent()))
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:56,代码来源:test_calendar.py

示例7: test_pick_default_other

# 需要导入模块: from twext.web2.test.test_server import SimpleRequest [as 别名]
# 或者: from twext.web2.test.test_server.SimpleRequest import locateResource [as 别名]
    def test_pick_default_other(self):
        """
        Make adbk
        """
        

        request = SimpleRequest(self.site, "GET", "/addressbooks/users/wsanchez/")
        home = yield request.locateResource("/addressbooks/users/wsanchez")

        # default property not present
        try:
            home.readDeadProperty(carddavxml.DefaultAddressBookURL)
        except HTTPError:
            pass
        else:
            self.fail("carddavxml.DefaultAddressBookURL is not empty")

        # Create a new default adbk
        newadbk = yield request.locateResource("/addressbooks/users/wsanchez/newadbk")
        yield newadbk.createAddressBookCollection()
        home.writeDeadProperty(carddavxml.DefaultAddressBookURL(
            HRef("/addressbooks/__uids__/6423F94A-6B76-4A3A-815B-D52CFD77935D/newadbk/")
        ))
        request._newStoreTransaction.commit()
        
        # Delete the normal adbk
        request = SimpleRequest(self.site, "GET", "/addressbooks/users/wsanchez/")
        home = yield request.locateResource("/addressbooks/users/wsanchez")
        adbk = yield request.locateResource("/addressbooks/users/wsanchez/addressbook")
        yield adbk.storeRemove(request, False, "/addressbooks/users/wsanchez/addressbook")

        home.removeDeadProperty(carddavxml.DefaultAddressBookURL)
        
        # default property not present
        try:
            home.readDeadProperty(carddavxml.DefaultAddressBookURL)
        except HTTPError:
            pass
        else:
            self.fail("carddavxml.DefaultAddressBookURL is not empty")
        request._newStoreTransaction.commit()

        request = SimpleRequest(self.site, "GET", "/addressbooks/users/wsanchez/")
        home = yield request.locateResource("/addressbooks/users/wsanchez")
        yield home.pickNewDefaultAddressBook(request)

        try:
            default = home.readDeadProperty(carddavxml.DefaultAddressBookURL)
        except HTTPError:
            self.fail("carddavxml.DefaultAddressBookURL is not present")
        else:
            self.assertEqual(str(default.children[0]), "/addressbooks/__uids__/6423F94A-6B76-4A3A-815B-D52CFD77935D/newadbk/")

        request._newStoreTransaction.abort()
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:56,代码来源:test_resource.py

示例8: test_pick_default_other

# 需要导入模块: from twext.web2.test.test_server import SimpleRequest [as 别名]
# 或者: from twext.web2.test.test_server.SimpleRequest import locateResource [as 别名]
    def test_pick_default_other(self):
        """
        Make calendar
        """

        request = SimpleRequest(self.site, "GET", "/calendars/users/wsanchez/")
        inbox = yield request.locateResource("/calendars/users/wsanchez/inbox")

        # default property not present
        try:
            inbox.readDeadProperty(caldavxml.ScheduleDefaultCalendarURL)
        except HTTPError:
            pass
        else:
            self.fail("caldavxml.ScheduleDefaultCalendarURL is not empty")

        # Create a new default calendar
        newcalendar = yield request.locateResource("/calendars/users/wsanchez/newcalendar")
        yield newcalendar.createCalendarCollection()
        inbox.writeDeadProperty(caldavxml.ScheduleDefaultCalendarURL(
            davxml.HRef("/calendars/__uids__/6423F94A-6B76-4A3A-815B-D52CFD77935D/newcalendar")
        ))

        # Delete the normal calendar
        calendar = yield request.locateResource("/calendars/users/wsanchez/calendar")
        yield calendar.storeRemove(request, False, "/calendars/users/wsanchez/calendar")

        inbox.removeDeadProperty(caldavxml.ScheduleDefaultCalendarURL)

        # default property not present
        try:
            inbox.readDeadProperty(caldavxml.ScheduleDefaultCalendarURL)
        except HTTPError:
            pass
        else:
            self.fail("caldavxml.ScheduleDefaultCalendarURL is not empty")
        request._newStoreTransaction.commit()

        request = SimpleRequest(self.site, "GET", "/calendars/users/wsanchez/")
        inbox = yield request.locateResource("/calendars/users/wsanchez/inbox")
        yield inbox.pickNewDefaultCalendar(request)

        try:
            default = inbox.readDeadProperty(caldavxml.ScheduleDefaultCalendarURL)
        except HTTPError:
            self.fail("caldavxml.ScheduleDefaultCalendarURL is not present")
        else:
            self.assertEqual(str(default.children[0]), "/calendars/__uids__/6423F94A-6B76-4A3A-815B-D52CFD77935D/newcalendar")

        request._newStoreTransaction.abort()
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:52,代码来源:test_resource.py

示例9: test_renderPrivileges

# 需要导入模块: from twext.web2.test.test_server import SimpleRequest [as 别名]
# 或者: from twext.web2.test.test_server.SimpleRequest import locateResource [as 别名]
    def test_renderPrivileges(self):
        """
        Verify that a directory listing includes children which you
        don't have access to.
        """
        request = SimpleRequest(self.site, "GET", "/")

        def setEmptyACL(resource):
            resource.setAccessControlList(davxml.ACL()) # Empty ACL = no access
            return resource

        def renderRoot(_):
            d = request.locateResource("/")
            d.addCallback(lambda r: r.render(request))

            return d

        def assertListing(response):
            data = []
            d = readStream(response.stream, lambda s: data.append(str(s)))
            d.addCallback(lambda _: self.failIf(
                'dir2/' not in "".join(data),
                "'dir2' expected in listing: %r" % (data,)
            ))
            return d

        d = request.locateResource("/dir2")
        d.addCallback(setEmptyACL)
        d.addCallback(renderRoot)
        d.addCallback(assertListing)

        return d
开发者ID:anemitz,项目名称:calendarserver,代码行数:34,代码来源:test_static.py

示例10: test_pick_default_addressbook

# 需要导入模块: from twext.web2.test.test_server import SimpleRequest [as 别名]
# 或者: from twext.web2.test.test_server.SimpleRequest import locateResource [as 别名]
    def test_pick_default_addressbook(self):
        """
        Make calendar
        """
        

        request = SimpleRequest(self.site, "GET", "/addressbooks/users/wsanchez/")
        home = yield request.locateResource("/addressbooks/users/wsanchez")

        # default property initially not present
        try:
            home.readDeadProperty(carddavxml.DefaultAddressBookURL)
        except HTTPError:
            pass
        else:
            self.fail("carddavxml.DefaultAddressBookURL is not empty")

        yield home.pickNewDefaultAddressBook(request)

        try:
            default = home.readDeadProperty(carddavxml.DefaultAddressBookURL)
        except HTTPError:
            self.fail("carddavxml.DefaultAddressBookURL is not present")
        else:
            self.assertEqual(str(default.children[0]), "/addressbooks/__uids__/6423F94A-6B76-4A3A-815B-D52CFD77935D/addressbook/")

        request._newStoreTransaction.abort()
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:29,代码来源:test_resource.py

示例11: test_pick_default_vtodo_calendar

# 需要导入模块: from twext.web2.test.test_server import SimpleRequest [as 别名]
# 或者: from twext.web2.test.test_server.SimpleRequest import locateResource [as 别名]
    def test_pick_default_vtodo_calendar(self):
        """
        Test that pickNewDefaultCalendar will choose the correct tasks calendar.
        """

        request = SimpleRequest(self.site, "GET", "/calendars/users/wsanchez/")
        inbox = yield request.locateResource("/calendars/users/wsanchez/inbox")

        # default property initially not present
        try:
            inbox.readDeadProperty(customxml.ScheduleDefaultTasksURL)
        except HTTPError:
            pass
        else:
            self.fail("customxml.ScheduleDefaultTasksURL is not empty")

        yield inbox.pickNewDefaultCalendar(request, tasks=True)

        try:
            default = inbox.readDeadProperty(customxml.ScheduleDefaultTasksURL)
        except HTTPError:
            self.fail("customxml.ScheduleDefaultTasksURL is not present")
        else:
            self.assertEqual(str(default.children[0]), "/calendars/__uids__/6423F94A-6B76-4A3A-815B-D52CFD77935D/tasks")

        request._newStoreTransaction.abort()
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:28,代码来源:test_resource.py

示例12: _checkPrivileges

# 需要导入模块: from twext.web2.test.test_server import SimpleRequest [as 别名]
# 或者: from twext.web2.test.test_server.SimpleRequest import locateResource [as 别名]
    def _checkPrivileges(self, resource, url, principal, privilege, allowed):
        request = SimpleRequest(self.site, "GET", "/")

        def gotResource(resource):
            d = resource.checkPrivileges(request, (privilege,), principal=davxml.Principal(principal))
            if allowed:
                def onError(f):
                    f.trap(AccessDeniedError)
                    #print(resource.readDeadProperty(davxml.ACL).toxml())
                    self.fail("%s should have %s privilege on %r" % (principal, privilege.sname(), resource))
                d.addErrback(onError)
            else:
                def onError(f):
                    f.trap(AccessDeniedError)
                def onSuccess(_):
                    #print(resource.readDeadProperty(davxml.ACL).toxml())
                    self.fail("%s should not have %s privilege on %r" % (principal, privilege.sname(), resource))
                d.addCallback(onSuccess)
                d.addErrback(onError)
            def _commit(ignore):
                maybeCommit(request)
            d.addBoth(_commit)
            return d

        d = request.locateResource(url)
        d.addCallback(gotResource)
        return d
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:29,代码来源:test_guidchange.py

示例13: test_checkPrivileges

# 需要导入模块: from twext.web2.test.test_server import SimpleRequest [as 别名]
# 或者: from twext.web2.test.test_server.SimpleRequest import locateResource [as 别名]
    def test_checkPrivileges(self):
        """
        DAVResource.checkPrivileges()
        """
        ds = []

        authAllResource = AuthAllResource()
        requested_access = (davxml.All(),)

        site = Site(authAllResource)

        def expectError(failure):
            failure.trap(AccessDeniedError)
            errors = failure.value.errors

            self.failUnless(len(errors) == 1)

            subpath, denials = errors[0]

            self.failUnless(subpath is None)
            self.failUnless(
                tuple(denials) == requested_access,
                "%r != %r" % (tuple(denials), requested_access)
            )

        def expectOK(result):
            self.failUnlessEquals(result, None)

        def _checkPrivileges(resource):
            d = resource.checkPrivileges(request, requested_access)
            return d

        # No auth; should deny
        request = SimpleRequest(site, "GET", "/")
        d = request.locateResource("/").addCallback(_checkPrivileges).addErrback(expectError)
        ds.append(d)

        # Has auth; should allow
        request = SimpleRequest(site, "GET", "/")
        request.authnUser = davxml.Principal(davxml.HRef("/users/d00d"))
        request.authzUser = davxml.Principal(davxml.HRef("/users/d00d"))
        d = request.locateResource("/")
        d.addCallback(_checkPrivileges)
        d.addCallback(expectOK)
        ds.append(d)

        return DeferredList(ds)
开发者ID:jrossi,项目名称:twext,代码行数:49,代码来源:test_resource.py

示例14: test_NonExistentCalendarHome

# 需要导入模块: from twext.web2.test.test_server import SimpleRequest [as 别名]
# 或者: from twext.web2.test.test_server.SimpleRequest import locateResource [as 别名]
    def test_NonExistentCalendarHome(self):

        def _response(resource):
            if resource is not None:
                self.fail("Incorrect response to GET on non-existent calendar home.")

        request = SimpleRequest(self.site, "GET", "/calendars/users/12345/")
        d = request.locateResource(request.uri)
        d.addCallback(_response)
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:11,代码来源:test_calendar.py

示例15: test_ExistentInbox

# 需要导入模块: from twext.web2.test.test_server import SimpleRequest [as 别名]
# 或者: from twext.web2.test.test_server.SimpleRequest import locateResource [as 别名]
    def test_ExistentInbox(self):

        def _response(resource):
            if resource is None:
                self.fail("Incorrect response to GET on existent inbox.")

        request = SimpleRequest(self.site, "GET", "/calendars/users/wsanchez/inbox/")
        d = request.locateResource(request.uri)
        d.addCallback(_response)
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:11,代码来源:test_calendar.py


注:本文中的twext.web2.test.test_server.SimpleRequest.locateResource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。