示例#1
0
 def test_secure_form(self):
     self.assertEqual(
         secure_form(url="http://www.example.com"),
         '<form action="http://www.example.com" method="POST">\n<div style="display: none;"><input id="%s" name="%s" type="hidden" value="%s" /></div>' % (token_key, token_key, self.authentication_token)
     )
     self.assertEqual(
         secure_form(url="http://www.example.com", method='GET'),
         '<form action="http://www.example.com" method="GET">\n<div style="display: none;"><input id="%s" name="%s" type="hidden" value="%s" /></div>' % (token_key, token_key, self.authentication_token)
     )
     self.assertEqual(
         secure_form(url('/test/edit/1')),
         '<form action="/test/edit/1" method="POST">\n<div style="display: none;"><input id="%s" name="%s" type="hidden" value="%s" /></div>' % (token_key, token_key, self.authentication_token)
     )
示例#2
0
 def test_form(self):
     self.assertEqual(
         form(url="http://www.example.com"),
         '<form action="http://www.example.com" method="POST">'
     )
     self.assertEqual(
         form(url="http://www.example.com", method='GET'),
         '<form action="http://www.example.com" method="GET">'
     )
     self.assertEqual(
         form(url('/test/edit/1')),
         '<form action="/test/edit/1" method="POST">'
     )