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 #1721: turbogears-sqlalchemy-0.4-rollback-test.patch
| File turbogears-sqlalchemy-0.4-rollback-test.patch,
1.2 KB
(added by toshio, 4 years ago) |
|
Test case for this issue
|
-
|
old
|
new
|
class RbRoot(RootController): |
| 158 | 158 | doerr = errorhandling.exception_handler(handerr)(doerr) |
| 159 | 159 | doerr = expose()(doerr) |
| 160 | 160 | |
| | 161 | def handexc(self, id): |
| | 162 | Person(id=id) |
| | 163 | try: |
| | 164 | Person(id=id) |
| | 165 | except: |
| | 166 | pass |
| | 167 | handexc = expose()(handexc) |
| | 168 | |
| 161 | 169 | def test_exc_rollback(): |
| 162 | 170 | cherrypy.root = RbRoot() |
| 163 | 171 | create_request('/doerr?id=24') |
| … |
… |
def test_exc_done_rollback(): |
| 172 | 180 | print cherrypy.response.body[0] |
| 173 | 181 | assert cherrypy.response.body[0] == '{"tg_flash": null}' |
| 174 | 182 | |
| | 183 | # Check that if the controller method catches a db exception, we don't still |
| | 184 | # raise an exception |
| | 185 | def test_exc_caught_rollback(): |
| | 186 | cherrypy.root = RbRoot() |
| | 187 | create_request('/handexc?id=27') |
| | 188 | output = cherrypy.response.body[0] |
| | 189 | print output |
| | 190 | assert '<title>500 Internal error</title>' not in output |
| | 191 | |
| 175 | 192 | #-- |
| 176 | 193 | # Check for session freshness, ticket #1419 |
| 177 | 194 | # It checks that changes made to the data in thread B are reflected in thread A. |
Download in other formats: