-
Notifications
You must be signed in to change notification settings - Fork 4
/
model.py
31 lines (26 loc) · 992 Bytes
/
model.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# This file is part of Tryton & Nereid. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.model import ModelSQL, fields
from trytond.pool import Pool
class TestModel(ModelSQL):
"""A Tryton model which uses Pagination which could be used for
testing."""
__name__ = "nereid.test.test_model"
name = fields.Char("Name")
@classmethod
def fail_with_transaction_error(cls):
"""
Just fail raising a DatabaseOperationalError
"""
from trytond import backend
DatabaseOperationalError = backend.get('DatabaseOperationalError')
raise DatabaseOperationalError()
@classmethod
def test_lazy_renderer(cls):
"""
Just call the home method and modify the headers in the return value
"""
rv = Pool().get('nereid.website').home()
rv.headers['X-Test-Header'] = 'TestValue'
rv.status = 201
return rv