[Zope3-checkins] CVS: Zope3/src/zope/server/http/tests - test_httpdate.py:1.1

Anthony Baxter anthony@interlink.com.au
Thu, 9 Jan 2003 07:45:38 -0500


Update of /cvs-repository/Zope3/src/zope/server/http/tests
In directory cvs.zope.org:/tmp/cvs-serv32729

Added Files:
	test_httpdate.py 
Log Message:
Test roundtrip parse_http_date(build_http_date(now)). Currently broken for
me (along with a bunch of cookie tests) because parse_http_date screws up
daylight savings.


=== Added File Zope3/src/zope/server/http/tests/test_httpdate.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""

$Id: test_httpdate.py,v 1.1 2003/01/09 12:45:33 anthony Exp $
"""

import unittest
from zope.server.http.http_date import build_http_date, parse_http_date

class Tests(unittest.TestCase):

    # test roundtrip conversion.
    def testDateRoundTrip(self):
	from time import time
	t = int(time())
	self.assertEquals(t, parse_http_date(build_http_date(t)))


def test_suite():
    loader = unittest.TestLoader()
    return loader.loadTestsFromTestCase(Tests)

if __name__=='__main__':
    unittest.TextTestRunner().run( test_suite() )