Commit 3a0274a8 authored by Shane Hathaway's avatar Shane Hathaway

Clarified expected behavior of tests.

parent 9eabf756
...@@ -85,8 +85,8 @@ ...@@ -85,8 +85,8 @@
"""Document Template Tests """Document Template Tests
""" """
__rcs_id__='$Id: testSecurity.py,v 1.2 2001/04/27 20:27:38 shane Exp $' __rcs_id__='$Id: testSecurity.py,v 1.3 2001/06/21 17:21:09 shane Exp $'
__version__='$Revision: 1.2 $'[11:-2] __version__='$Revision: 1.3 $'[11:-2]
import sys, os import sys, os
import unittest import unittest
...@@ -117,10 +117,11 @@ class SecurityTests (DTMLTests): ...@@ -117,10 +117,11 @@ class SecurityTests (DTMLTests):
class person: class person:
name='Jim' name='Jim'
doc = self.doc_class(
'<dtml-with person>Hi, my name is '
'<dtml-var name></dtml-with>')
try: try:
res = self.doc_class( doc(person=person)
'<dtml-with person>Hi, my name is '
'<dtml-var name></dtml-with>')(person=person)
except Unauthorized: except Unauthorized:
# Passed the test. # Passed the test.
pass pass
...@@ -136,7 +137,7 @@ class SecurityTests (DTMLTests): ...@@ -136,7 +137,7 @@ class SecurityTests (DTMLTests):
html = self.doc_class('<dtml-var expr="myinst.somemethod()">') html = self.doc_class('<dtml-var expr="myinst.somemethod()">')
try: try:
res = html(myinst=myclass()) html(myinst=myclass())
except Unauthorized: except Unauthorized:
# Passed the test. # Passed the test.
pass pass
...@@ -151,8 +152,8 @@ class SecurityTests (DTMLTests): ...@@ -151,8 +152,8 @@ class SecurityTests (DTMLTests):
expr = '<dtml-var expr="(lambda x, _read=(lambda ob:ob): x.y)(c)">' expr = '<dtml-var expr="(lambda x, _read=(lambda ob:ob): x.y)(c)">'
try: try:
# This would be a security hole. # This would be a security hole.
html = self.doc_class(expr) html = self.doc_class(expr) # It might compile here...
html() html() # or it might compile here.
except SyntaxError: except SyntaxError:
# Passed the test. # Passed the test.
pass pass
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment