Mercurial > p > roundup > code
diff test/test_templating.py @ 8305:a81a3cd067fa
Generate savepoint only if necessary
Now some methods got an additional 'allow_abort' parameter. By default
this is True. When False the postgres backend generates a savepoint.
The methods are called with allow_abort=False from some of the cgi
methods which can produce a traceback when called with data from the
web-interface.
| author | Ralf Schlatterbeck <rsc@runtux.com> |
|---|---|
| date | Sat, 01 Mar 2025 18:55:54 +0100 |
| parents | b99e76e76496 |
| children | 4455cd036c25 |
line wrap: on
line diff
--- a/test/test_templating.py Sat Mar 01 13:08:09 2025 +0100 +++ b/test/test_templating.py Sat Mar 01 18:55:54 2025 +0100 @@ -143,7 +143,9 @@ db = MockNull(issue = HTMLDatabase(self.client).issue) db.issue._klass.list = lambda : ['23', 'a', 'b'] # Make db.getclass return something that has a sensible 'get' method - mock = MockNull(get = lambda x, y : None) + def get(x, y, allow_abort=True): + return None + mock = MockNull(get = get) db.issue._db.getclass = lambda x : mock l = db.issue.list() @@ -170,7 +172,7 @@ def test_lookupKeys(self): db = HTMLDatabase(self.client) - def get(entry, key): + def get(entry, key, allow_abort=True): return {'1': 'green', '2': 'eggs'}.get(entry, entry) shrubbery = MockNull(get=get) db._db.classes = {'shrubbery': shrubbery}
