author | Adrien Di Mascio <Adrien.DiMascio@logilab.fr> |
Thu, 19 Feb 2009 22:17:39 +0100 | |
branch | tls-sprint |
changeset 868 | 5d993a0c794c |
parent 866 | 6fdb029663ca |
child 869 | 168ad6d424d1 |
permissions | -rw-r--r-- |
866
6fdb029663ca
use EnvBasedTC since we need to access the schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
848
diff
changeset
|
1 |
from logilab.common.testlib import unittest_main, mock_object |
6fdb029663ca
use EnvBasedTC since we need to access the schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
848
diff
changeset
|
2 |
from cubicweb.devtools.apptest import EnvBasedTC |
847
27c4ebe90d03
prefixed form methods to avoid potential conflicts with field names, button related method, a bit more serious renderer
sylvain.thenault@logilab.fr
parents:
845
diff
changeset
|
3 |
from cubicweb.web.form import * |
27c4ebe90d03
prefixed form methods to avoid potential conflicts with field names, button related method, a bit more serious renderer
sylvain.thenault@logilab.fr
parents:
845
diff
changeset
|
4 |
from cubicweb.web.views.baseforms import ChangeStateForm |
845 | 5 |
|
6 |
class CustomChangeStateForm(ChangeStateForm): |
|
7 |
hello = IntField(name='youlou') |
|
868
5d993a0c794c
update test, use a DateTimePicker widget
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
866
diff
changeset
|
8 |
creation_date = DateTimeField(widget=DateTimePicker) |
5d993a0c794c
update test, use a DateTimePicker widget
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
866
diff
changeset
|
9 |
|
866
6fdb029663ca
use EnvBasedTC since we need to access the schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
848
diff
changeset
|
10 |
class EntityFieldsFormTC(EnvBasedTC): |
845 | 11 |
|
847
27c4ebe90d03
prefixed form methods to avoid potential conflicts with field names, button related method, a bit more serious renderer
sylvain.thenault@logilab.fr
parents:
845
diff
changeset
|
12 |
def setUp(self): |
866
6fdb029663ca
use EnvBasedTC since we need to access the schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
848
diff
changeset
|
13 |
super(EntityFieldsFormTC, self).setUp() |
868
5d993a0c794c
update test, use a DateTimePicker widget
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
866
diff
changeset
|
14 |
self.req = self.request() |
5d993a0c794c
update test, use a DateTimePicker widget
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
866
diff
changeset
|
15 |
self.entity = self.user(self.req) |
847
27c4ebe90d03
prefixed form methods to avoid potential conflicts with field names, button related method, a bit more serious renderer
sylvain.thenault@logilab.fr
parents:
845
diff
changeset
|
16 |
|
845 | 17 |
def test(self): |
868
5d993a0c794c
update test, use a DateTimePicker widget
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
866
diff
changeset
|
18 |
form = ChangeStateForm(self.req, redirect_path='perdu.com') |
5d993a0c794c
update test, use a DateTimePicker widget
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
866
diff
changeset
|
19 |
self.assertEquals(form.form_render(self.entity, state=123), |
866
6fdb029663ca
use EnvBasedTC since we need to access the schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
848
diff
changeset
|
20 |
''' ''') |
845 | 21 |
|
22 |
def test_form_inheritance(self): |
|
847
27c4ebe90d03
prefixed form methods to avoid potential conflicts with field names, button related method, a bit more serious renderer
sylvain.thenault@logilab.fr
parents:
845
diff
changeset
|
23 |
form = CustomChangeStateForm(self.req, redirect_path='perdu.com') |
27c4ebe90d03
prefixed form methods to avoid potential conflicts with field names, button related method, a bit more serious renderer
sylvain.thenault@logilab.fr
parents:
845
diff
changeset
|
24 |
self.assertEquals(form.form_render(self.entity, state=123), |
866
6fdb029663ca
use EnvBasedTC since we need to access the schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
848
diff
changeset
|
25 |
''' ''') |
845 | 26 |
|
27 |
||
28 |
if __name__ == '__main__': |
|
29 |
unittest_main() |