[Zope-Checkins] CVS: Zope/lib/python/Products/PageTemplates/tests -
test_ptfile.py:1.3
Stuart Bishop
zen at shangri-la.dropbear.id.au
Sat Dec 13 02:57:51 EST 2003
Update of /cvs-repository/Zope/lib/python/Products/PageTemplates/tests
In directory cvs.zope.org:/tmp/cvs-serv22166/lib/python/Products/PageTemplates/tests
Modified Files:
test_ptfile.py
Log Message:
Merging to HEAD
Added getId() to Item_w__name__, since the one inherited from Item
has broken __name__ handling.
PageTemplateFile now using Item_w__name__ mixin, making getId()
and absolute_url() actually work.
=== Zope/lib/python/Products/PageTemplates/tests/test_ptfile.py 1.2 => 1.3 ===
--- Zope/lib/python/Products/PageTemplates/tests/test_ptfile.py:1.2 Tue Apr 22 12:16:36 2003
+++ Zope/lib/python/Products/PageTemplates/tests/test_ptfile.py Sat Dec 13 02:57:50 2003
@@ -1,6 +1,6 @@
"""Tests of PageTemplateFile."""
-import os
+import os, os.path
import tempfile
import unittest
@@ -118,6 +118,33 @@
self.check_content_type("<doc><element/></doc>",
"text/xml")
+ def test_getId(self):
+ desired_id = os.path.splitext(os.path.split(self.TEMPFILENAME)[-1])[0]
+ f = open(self.TEMPFILENAME, 'w')
+ print >> f, 'Boring'
+ f.close()
+ pt = PageTemplateFile(self.TEMPFILENAME)
+ pt_id = pt.getId()
+ self.failUnlessEqual(
+ pt_id, desired_id,
+ 'getId() returned %r. Expecting %r' % (pt_id, desired_id)
+ )
+
+ def test_getPhysicalPath(self):
+ desired_id = os.path.splitext(os.path.split(self.TEMPFILENAME)[-1])[0]
+ desired_path = (desired_id,)
+ f = open(self.TEMPFILENAME, 'w')
+ print >> f, 'Boring'
+ f.close()
+ pt = PageTemplateFile(self.TEMPFILENAME)
+ pt_path = pt.getPhysicalPath()
+ self.failUnlessEqual(
+ pt_path, desired_path,
+ 'getPhysicalPath() returned %r. Expecting %r' % (
+ desired_path, pt_path,
+ )
+ )
+
def test_suite():
return unittest.makeSuite(TypeSniffingTestCase)
More information about the Zope-Checkins
mailing list