def testMakeHiddenInput(self): tag = make_hidden_input(foo='bar') self.assertEqual(tag, '<input type="hidden" name="foo" value="bar">') tag = make_hidden_input(foo=1) self.assertEqual(tag, '<input type="hidden" name="foo:int" value="1">') # Escaping tag = make_hidden_input(foo='bar & baz') self.assertEqual(tag, '<input type="hidden" name="foo" value="bar & baz">') tag = make_hidden_input(foo='<bar>') self.assertEqual(tag, '<input type="hidden" name="foo" value="<bar>">') tag = make_hidden_input(foo='"bar"') self.assertEqual(tag, '<input type="hidden" name="foo" value=""bar"">')
def testMakeHiddenInput(self): test_unicode = u'unic\xF3de' quote_unicode = test_unicode.encode('utf8') tag = make_hidden_input(foo=test_unicode) #set 'zpublisher_default_encoding' to utf8 self.assertEqual( tag, '<input type="hidden" name="foo:utf8:ustring" value="%s">' % (quote_unicode, ))
def testMakeHiddenInput(self): test_unicode = u'unic\xF3de' quote_unicode = test_unicode.encode('utf8') tag = make_hidden_input(foo=test_unicode) #set 'zpublisher_default_encoding' to utf8 self.assertEqual(tag, '<input type="hidden" name="foo:utf8:ustring" value="%s">' % (quote_unicode,))