author | Aurelien Campeas <aurelien.campeas@logilab.fr> |
Mon, 17 Dec 2012 14:26:41 +0100 | |
branch | stable |
changeset 8633 | 36197bd1d78b |
parent 8030 | 552d85fcb587 |
child 8665 | e65af61bde7d |
permissions | -rw-r--r-- |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4997
diff
changeset
|
1 |
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4997
diff
changeset
|
2 |
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4997
diff
changeset
|
3 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4997
diff
changeset
|
4 |
# This file is part of CubicWeb. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4997
diff
changeset
|
5 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4997
diff
changeset
|
6 |
# CubicWeb is free software: you can redistribute it and/or modify it under the |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4997
diff
changeset
|
7 |
# terms of the GNU Lesser General Public License as published by the Free |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4997
diff
changeset
|
8 |
# Software Foundation, either version 2.1 of the License, or (at your option) |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4997
diff
changeset
|
9 |
# any later version. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4997
diff
changeset
|
10 |
# |
5424
8ecbcbff9777
replace logilab-common by CubicWeb in disclaimer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5421
diff
changeset
|
11 |
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4997
diff
changeset
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4997
diff
changeset
|
13 |
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4997
diff
changeset
|
14 |
# details. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4997
diff
changeset
|
15 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4997
diff
changeset
|
16 |
# You should have received a copy of the GNU Lesser General Public License along |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4997
diff
changeset
|
17 |
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
8030
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
18 |
import copy |
5842
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
19 |
from logilab.common.testlib import tag |
3464
99bd1ea0394a
[tests] make unittest_uicfg pass again by using the correct test class
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3125
diff
changeset
|
20 |
from cubicweb.devtools.testlib import CubicWebTC |
8030
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
21 |
from cubicweb.web import uicfg, uihelper, formwidgets as fwdgs |
3125
52b6b8c2ccc5
[uicfg, autoform] when a relation is inlined, put it in the generated section by default
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
22 |
|
4997
aed7bdb9da54
[web test] a basic test, to be completed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4083
diff
changeset
|
23 |
abaa = uicfg.actionbox_appearsin_addmenu |
aed7bdb9da54
[web test] a basic test, to be completed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4083
diff
changeset
|
24 |
|
3464
99bd1ea0394a
[tests] make unittest_uicfg pass again by using the correct test class
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3125
diff
changeset
|
25 |
class UICFGTC(CubicWebTC): |
3125
52b6b8c2ccc5
[uicfg, autoform] when a relation is inlined, put it in the generated section by default
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
26 |
|
4997
aed7bdb9da54
[web test] a basic test, to be completed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4083
diff
changeset
|
27 |
def test_default_actionbox_appearsin_addmenu_config(self): |
7791
31bb51ea5485
[deprecation] fix unittest pending deprecation warnings on failIf/failUnless methods family
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6340
diff
changeset
|
28 |
self.assertFalse(abaa.etype_get('TrInfo', 'wf_info_for', 'object', 'CWUser')) |
3125
52b6b8c2ccc5
[uicfg, autoform] when a relation is inlined, put it in the generated section by default
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
29 |
|
5842
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
30 |
|
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
31 |
|
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
32 |
class DefinitionOrderTC(CubicWebTC): |
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
33 |
"""This test check that when multiple definition could match a key, only |
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
34 |
the more accurate apply""" |
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
35 |
|
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
36 |
def setUp(self): |
8030
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
37 |
super(DefinitionOrderTC, self).setUp() |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
38 |
for rtag in (uicfg.autoform_section, uicfg.autoform_field_kwargs): |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
39 |
rtag._old_tagdefs = copy.deepcopy(rtag._tagdefs) |
5842
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
40 |
new_def = ( |
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
41 |
(('*', 'login', '*'), |
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
42 |
{'formtype':'main', 'section':'hidden'}), |
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
43 |
(('*', 'login', '*'), |
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
44 |
{'formtype':'muledit', 'section':'hidden'}), |
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
45 |
(('CWUser', 'login', '*'), |
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
46 |
{'formtype':'main', 'section':'attributes'}), |
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
47 |
(('CWUser', 'login', '*'), |
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
48 |
{'formtype':'muledit', 'section':'attributes'}), |
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
49 |
(('CWUser', 'login', 'String'), |
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
50 |
{'formtype':'main', 'section':'inlined'}), |
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
51 |
(('CWUser', 'login', 'String'), |
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
52 |
{'formtype':'inlined', 'section':'attributes'}), |
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
53 |
) |
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
54 |
for key, kwargs in new_def: |
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
55 |
uicfg.autoform_section.tag_subject_of(key, **kwargs) |
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
56 |
|
8030
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
57 |
def tearDown(self): |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
58 |
super(DefinitionOrderTC, self).tearDown() |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
59 |
for rtag in (uicfg.autoform_section, uicfg.autoform_field_kwargs): |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
60 |
rtag._tagdefs = rtag._old_tagdefs |
5842
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
61 |
|
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
62 |
@tag('uicfg') |
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
63 |
def test_definition_order_hidden(self): |
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
64 |
result = uicfg.autoform_section.get('CWUser', 'login', 'String', 'subject') |
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
65 |
expected = set(['main_inlined', 'muledit_attributes', 'inlined_attributes']) |
6340
470d8e828fda
[test] update test to unittest2 api (still using lgc.testlib though)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5842
diff
changeset
|
66 |
self.assertSetEqual(result, expected) |
5842
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
67 |
|
8030
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
68 |
@tag('uihelper', 'order', 'func') |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
69 |
def test_uihelper_set_fields_order(self): |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
70 |
afk_get = uicfg.autoform_field_kwargs.get |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
71 |
self.assertEqual(afk_get('CWUser', 'firstname', 'String', 'subject'), {}) |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
72 |
uihelper.set_fields_order('CWUser', ('login', 'firstname', 'surname')) |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
73 |
self.assertEqual(afk_get('CWUser', 'firstname', 'String', 'subject'), {'order': 1}) |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
74 |
|
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
75 |
@tag('uihelper', 'kwargs', 'func') |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
76 |
def test_uihelper_set_field_kwargs(self): |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
77 |
afk_get = uicfg.autoform_field_kwargs.get |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
78 |
self.assertEqual(afk_get('CWUser', 'firstname', 'String', 'subject'), {}) |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
79 |
wdg = fwdgs.TextInput({'size': 30}) |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
80 |
uihelper.set_field_kwargs('CWUser', 'firstname', widget=wdg) |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
81 |
self.assertEqual(afk_get('CWUser', 'firstname', 'String', 'subject'), {'widget': wdg}) |
5842
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
82 |
|
8030
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
83 |
@tag('uihelper', 'hidden', 'func') |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
84 |
def test_uihelper_hide_fields(self): |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
85 |
# original conf : in_group is edited in 'attributes' section everywhere |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
86 |
section_conf = uicfg.autoform_section.get('CWUser', 'in_group', '*', 'subject') |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
87 |
self.assertItemsEqual(section_conf, ['main_attributes', 'muledit_attributes']) |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
88 |
# hide field in main form |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
89 |
uihelper.hide_fields('CWUser', ('login', 'in_group')) |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
90 |
section_conf = uicfg.autoform_section.get('CWUser', 'in_group', '*', 'subject') |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
91 |
self.assertItemsEqual(section_conf, ['main_hidden', 'muledit_attributes']) |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
92 |
# hide field in muledit form |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
93 |
uihelper.hide_fields('CWUser', ('login', 'in_group'), formtype='muledit') |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
94 |
section_conf = uicfg.autoform_section.get('CWUser', 'in_group', '*', 'subject') |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
95 |
self.assertItemsEqual(section_conf, ['main_hidden', 'muledit_hidden']) |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
96 |
|
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
97 |
@tag('uihelper', 'hidden', 'formconfig') |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
98 |
def test_uihelper_formconfig(self): |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
99 |
afk_get = uicfg.autoform_field_kwargs.get |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
100 |
class CWUserFormConfig(uihelper.FormConfig): |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
101 |
etype = 'CWUser' |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
102 |
hidden = ('in_group',) |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
103 |
fields_order = ('login', 'firstname') |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
104 |
section_conf = uicfg.autoform_section.get('CWUser', 'in_group', '*', 'subject') |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
105 |
self.assertItemsEqual(section_conf, ['main_hidden', 'muledit_attributes']) |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
106 |
self.assertEqual(afk_get('CWUser', 'firstname', 'String', 'subject'), {'order': 1}) |
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
107 |
|
552d85fcb587
[uicfg] add uihelper module with high-level helpers (closes #1809414)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
7791
diff
changeset
|
108 |
|
5842
10efd227648e
[fix] fix a uicfg bug in autoform_section
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
5424
diff
changeset
|
109 |
|
3125
52b6b8c2ccc5
[uicfg, autoform] when a relation is inlined, put it in the generated section by default
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
110 |
if __name__ == '__main__': |
52b6b8c2ccc5
[uicfg, autoform] when a relation is inlined, put it in the generated section by default
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
111 |
from logilab.common.testlib import unittest_main |
52b6b8c2ccc5
[uicfg, autoform] when a relation is inlined, put it in the generated section by default
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
112 |
unittest_main() |