示例#1
0
    def test_304_response_from_cpm(self):
        # test that we get a 304 response from the cpm via this template
        mod_time = DateTime()
        cpm = DummyCachingManagerWithPolicy()
        getSiteManager().registerUtility(cpm, ICachingPolicyManager)
        content = DummyContent(id='content')
        content.modified_date = mod_time
        content = content.__of__(self.app)
        script = self._makeOne('testDTML', 'testDTML.dtml')
        script = script.__of__(content)
        self.REQUEST.environ['IF_MODIFIED_SINCE'
                            ] = '%s;' % rfc1123_date(mod_time + 3600)
        data = script(content, self.REQUEST, self.RESPONSE)

        self.assertEqual(data, '')
        self.assertEqual(self.RESPONSE.getStatus(), 304)
示例#2
0
    def test_304_response_from_cpm(self):
        # test that we get a 304 response from the cpm via this template

        from webdav.common import rfc1123_date

        mod_time = DateTime()
        self.root.caching_policy_manager = DummyCachingManagerWithPolicy()
        content = DummyContent(id="content")
        content.modified_date = mod_time
        content = content.__of__(self.root)
        script = self._makeOne("testDTML", "testDTML.dtml")
        script = script.__of__(content)
        self.REQUEST.environ["IF_MODIFIED_SINCE"] = "%s;" % rfc1123_date(mod_time + 3600)
        data = script(content, self.REQUEST, self.RESPONSE)

        self.assertEqual(data, "")
        self.assertEqual(self.RESPONSE.getStatus(), 304)
示例#3
0
    def test_304_response_from_cpm(self):
        # test that we get a 304 response from the cpm via this template

        from webdav.common import rfc1123_date

        mod_time = DateTime()
        self.root.caching_policy_manager = DummyCachingManagerWithPolicy()
        content = DummyContent(id='content')
        content.modified_date = mod_time
        content = content.__of__(self.root)
        script = self._makeOne('testDTML', 'testDTML.dtml')
        script = script.__of__(content)
        self.REQUEST.environ['IF_MODIFIED_SINCE'] = '%s;' % rfc1123_date(
            mod_time + 3600)
        data = script(content, self.REQUEST, self.RESPONSE)

        self.assertEqual(data, '')
        self.assertEqual(self.RESPONSE.getStatus(), 304)