Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1164: test.patch

File test.patch, 1.5 KB (added by Joost, 5 years ago)

test

  • test_controllers.py

     
    162162    flash_redirected = turbogears.expose(html=".simple", 
    163163        allow_json=True)(flash_redirected) 
    164164 
     165    def flash_with_commas(self): 
     166        turbogears.flash("Foo,Bar") 
     167        return dict(title="Foobar", mybool=False, someval="niggles") 
     168    flash_with_commas = turbogears.expose(html=".simple", 
     169        allow_json=True)(flash_with_commas) 
    165170 
     171 
    166172class TestRoot(unittest.TestCase): 
    167173    def setUp(self): 
    168174        cherrypy.root = None 
     
    357363        assert values["tg_flash"]=="plain" 
    358364        assert not cherrypy.response.simple_cookie.has_key("tg_flash") 
    359365 
     366    def test_flash_with_commas(self): 
     367        "turbogears.flash with strings that contain commas should work" 
     368        # Trac ticket 1164: The turbogears.flash() function doesn't work 
     369        # ... if the message string contains a comma (",") character. 
     370        testutil.createRequest("/flash_with_commas?tg_format=json") 
     371        import simplejson 
     372        values = simplejson.loads(cherrypy.response.body[0]) 
     373        assert values["tg_flash"]=="Foo,Bar", values["tg_flash"] 
     374        assert not cherrypy.response.simple_cookie.has_key("tg_flash") 
     375 
    360376    def test_flash_unicode(self): 
    361377        "turbogears.flash with unicode objects should work" 
    362378        testutil.createRequest("/flash_unicode?tg_format=json")