OXIESEC PANEL
- Current Dir:
/
/
usr
/
lib
/
python3
/
dist-packages
/
twisted
/
web
/
test
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
03/31/2022 06:22:39 AM
rwxr-xr-x
📄
__init__.py
108 bytes
09/08/2017 10:38:36 AM
rw-r--r--
📁
__pycache__
-
03/31/2022 06:22:40 AM
rwxr-xr-x
📄
_util.py
2.51 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
injectionhelpers.py
5.5 KB
03/22/2022 11:03:56 AM
rw-r--r--
📄
requesthelper.py
10.6 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_agent.py
113.19 KB
03/22/2022 11:03:56 AM
rw-r--r--
📄
test_cgi.py
13.29 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_client.py
1.34 KB
09/08/2017 10:38:35 AM
rw-r--r--
📄
test_distrib.py
16.02 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_domhelpers.py
10.84 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_error.py
15.83 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_flatten.py
17.83 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_html.py
1.23 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_http.py
122.6 KB
03/22/2022 11:03:56 AM
rw-r--r--
📄
test_http2.py
105.98 KB
03/22/2022 11:03:56 AM
rw-r--r--
📄
test_http_headers.py
19.91 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_httpauth.py
22.75 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_newclient.py
102.47 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_proxy.py
19.62 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_resource.py
8.02 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_script.py
3.7 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_stan.py
5.53 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_static.py
62.22 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_tap.py
10.34 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_template.py
24.99 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_util.py
12.29 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_vhost.py
7.22 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_web.py
55.24 KB
03/22/2022 11:03:56 AM
rw-r--r--
📄
test_web__responses.py
877 bytes
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_webclient.py
57.45 KB
03/22/2022 11:03:56 AM
rw-r--r--
📄
test_wsgi.py
73.06 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_xml.py
41.36 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_xmlrpc.py
28.24 KB
09/08/2017 10:38:36 AM
rw-r--r--
Editing: test_stan.py
Close
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Tests for L{twisted.web._stan} portion of the L{twisted.web.template} implementation. """ from __future__ import absolute_import, division from twisted.web.template import Comment, CDATA, CharRef, Tag from twisted.trial.unittest import TestCase from twisted.python.compat import _PY3 def proto(*a, **kw): """ Produce a new tag for testing. """ return Tag('hello')(*a, **kw) class TagTests(TestCase): """ Tests for L{Tag}. """ def test_fillSlots(self): """ L{Tag.fillSlots} returns self. """ tag = proto() self.assertIdentical(tag, tag.fillSlots(test='test')) def test_cloneShallow(self): """ L{Tag.clone} copies all attributes and children of a tag, including its render attribute. If the shallow flag is C{False}, that's where it stops. """ innerList = ["inner list"] tag = proto("How are you", innerList, hello="world", render="aSampleMethod") tag.fillSlots(foo='bar') tag.filename = "foo/bar" tag.lineNumber = 6 tag.columnNumber = 12 clone = tag.clone(deep=False) self.assertEqual(clone.attributes['hello'], 'world') self.assertNotIdentical(clone.attributes, tag.attributes) self.assertEqual(clone.children, ["How are you", innerList]) self.assertNotIdentical(clone.children, tag.children) self.assertIdentical(clone.children[1], innerList) self.assertEqual(tag.slotData, clone.slotData) self.assertNotIdentical(tag.slotData, clone.slotData) self.assertEqual(clone.filename, "foo/bar") self.assertEqual(clone.lineNumber, 6) self.assertEqual(clone.columnNumber, 12) self.assertEqual(clone.render, "aSampleMethod") def test_cloneDeep(self): """ L{Tag.clone} copies all attributes and children of a tag, including its render attribute. In its normal operating mode (where the deep flag is C{True}, as is the default), it will clone all sub-lists and sub-tags. """ innerTag = proto("inner") innerList = ["inner list"] tag = proto("How are you", innerTag, innerList, hello="world", render="aSampleMethod") tag.fillSlots(foo='bar') tag.filename = "foo/bar" tag.lineNumber = 6 tag.columnNumber = 12 clone = tag.clone() self.assertEqual(clone.attributes['hello'], 'world') self.assertNotIdentical(clone.attributes, tag.attributes) self.assertNotIdentical(clone.children, tag.children) # sanity check self.assertIdentical(tag.children[1], innerTag) # clone should have sub-clone self.assertNotIdentical(clone.children[1], innerTag) # sanity check self.assertIdentical(tag.children[2], innerList) # clone should have sub-clone self.assertNotIdentical(clone.children[2], innerList) self.assertEqual(tag.slotData, clone.slotData) self.assertNotIdentical(tag.slotData, clone.slotData) self.assertEqual(clone.filename, "foo/bar") self.assertEqual(clone.lineNumber, 6) self.assertEqual(clone.columnNumber, 12) self.assertEqual(clone.render, "aSampleMethod") def test_clear(self): """ L{Tag.clear} removes all children from a tag, but leaves its attributes in place. """ tag = proto("these are", "children", "cool", andSoIs='this-attribute') tag.clear() self.assertEqual(tag.children, []) self.assertEqual(tag.attributes, {'andSoIs': 'this-attribute'}) def test_suffix(self): """ L{Tag.__call__} accepts Python keywords with a suffixed underscore as the DOM attribute of that literal suffix. """ proto = Tag('div') tag = proto() tag(class_='a') self.assertEqual(tag.attributes, {'class': 'a'}) def test_commentReprPy2(self): """ L{Comment.__repr__} returns a value which makes it easy to see what's in the comment. """ self.assertEqual(repr(Comment(u"hello there")), "Comment(u'hello there')") def test_cdataReprPy2(self): """ L{CDATA.__repr__} returns a value which makes it easy to see what's in the comment. """ self.assertEqual(repr(CDATA(u"test data")), "CDATA(u'test data')") def test_commentReprPy3(self): """ L{Comment.__repr__} returns a value which makes it easy to see what's in the comment. """ self.assertEqual(repr(Comment(u"hello there")), "Comment('hello there')") def test_cdataReprPy3(self): """ L{CDATA.__repr__} returns a value which makes it easy to see what's in the comment. """ self.assertEqual(repr(CDATA(u"test data")), "CDATA('test data')") if not _PY3: test_commentReprPy3.skip = "Only relevant on Python 3." test_cdataReprPy3.skip = "Only relevant on Python 3." else: test_commentReprPy2.skip = "Only relevant on Python 2." test_cdataReprPy2.skip = "Only relevant on Python 2." def test_charrefRepr(self): """ L{CharRef.__repr__} returns a value which makes it easy to see what character is referred to. """ snowman = ord(u"\N{SNOWMAN}") self.assertEqual(repr(CharRef(snowman)), "CharRef(9731)")