author | Alexandre Fayolle <alexandre.fayolle@logilab.fr> |
Fri, 26 Aug 2011 17:14:37 +0200 | |
branch | oldstable |
changeset 7753 | 681ef2a664dd |
parent 7161 | e3f69df8dac7 |
child 7584 | e1881933f366 |
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:
4678
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:
4678
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:
4678
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:
4678
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:
4678
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:
4678
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:
4678
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:
4678
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:
4678
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:
4678
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:
4678
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:
4678
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:
4678
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:
4678
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:
4678
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:
4678
diff
changeset
|
17 |
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
2005
e8032965f37a
turn every form class into appobject. They should not be instantiated manually anymore.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1995
diff
changeset
|
18 |
|
2145 | 19 |
from xml.etree.ElementTree import fromstring |
20 |
||
866
6fdb029663ca
use EnvBasedTC since we need to access the schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
848
diff
changeset
|
21 |
from logilab.common.testlib import unittest_main, mock_object |
3757 | 22 |
from logilab.common.compat import any |
2005
e8032965f37a
turn every form class into appobject. They should not be instantiated manually anymore.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1995
diff
changeset
|
23 |
|
907 | 24 |
from cubicweb import Binary |
2773
b2530e3e0afb
[testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2755
diff
changeset
|
25 |
from cubicweb.devtools.testlib import CubicWebTC |
1111
bcb81e7c41bc
fix test: form_add_entity_hiddens *must* be called before build context, resulting in slightly different outputs...
sylvain.thenault@logilab.fr
parents:
1074
diff
changeset
|
26 |
from cubicweb.web.formfields import (IntField, StringField, RichTextField, |
4390 | 27 |
PasswordField, DateTimeField, |
1111
bcb81e7c41bc
fix test: form_add_entity_hiddens *must* be called before build context, resulting in slightly different outputs...
sylvain.thenault@logilab.fr
parents:
1074
diff
changeset
|
28 |
FileField, EditableFileField) |
4390 | 29 |
from cubicweb.web.formwidgets import PasswordInput, Input, DateTimePicker |
2005
e8032965f37a
turn every form class into appobject. They should not be instantiated manually anymore.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1995
diff
changeset
|
30 |
from cubicweb.web.views.forms import EntityFieldsForm, FieldsForm |
1111
bcb81e7c41bc
fix test: form_add_entity_hiddens *must* be called before build context, resulting in slightly different outputs...
sylvain.thenault@logilab.fr
parents:
1074
diff
changeset
|
31 |
from cubicweb.web.views.workflow import ChangeStateForm |
1995
ec95eaa2b711
turn renderers into appobjects
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1983
diff
changeset
|
32 |
from cubicweb.web.views.formrenderers import FormRenderer |
845 | 33 |
|
869
168ad6d424d1
form to edit multiple entities, use it in DeleteConfForm
sylvain.thenault@logilab.fr
parents:
868
diff
changeset
|
34 |
|
2773
b2530e3e0afb
[testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2755
diff
changeset
|
35 |
class FieldsFormTC(CubicWebTC): |
1359 | 36 |
|
37 |
def test_form_field_format(self): |
|
38 |
form = FieldsForm(self.request(), None) |
|
6340
470d8e828fda
[test] update test to unittest2 api (still using lgc.testlib though)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5914
diff
changeset
|
39 |
self.assertEqual(StringField().format(form), 'text/html') |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1393
diff
changeset
|
40 |
self.execute('INSERT CWProperty X: X pkey "ui.default-text-format", X value "text/rest", X for_user U WHERE U login "admin"') |
1359 | 41 |
self.commit() |
6340
470d8e828fda
[test] update test to unittest2 api (still using lgc.testlib though)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5914
diff
changeset
|
42 |
self.assertEqual(StringField().format(form), 'text/rest') |
1359 | 43 |
|
44 |
||
2773
b2530e3e0afb
[testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2755
diff
changeset
|
45 |
class EntityFieldsFormTC(CubicWebTC): |
845 | 46 |
|
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
|
47 |
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
|
48 |
super(EntityFieldsFormTC, self).setUp() |
868
5d993a0c794c
update test, use a DateTimePicker widget
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
866
diff
changeset
|
49 |
self.req = self.request() |
5d993a0c794c
update test, use a DateTimePicker widget
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
866
diff
changeset
|
50 |
self.entity = self.user(self.req) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
51 |
|
1345 | 52 |
def test_form_field_vocabulary_unrelated(self): |
4172
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
53 |
b = self.req.create_entity('BlogEntry', title=u'di mascii code', content=u'a best-seller') |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
54 |
t = self.req.create_entity('Tag', name=u'x') |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
55 |
form1 = self.vreg['forms'].select('edition', self.req, entity=t) |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
56 |
unrelated = [reid for rview, reid in form1.field_by_name('tags', 'subject', t.e_schema).choices(form1)] |
5914
dc5a77a2e485
[form] test update/remove deprecation warnings: form vocabulary should contains unicode values
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5873
diff
changeset
|
57 |
self.failUnless(unicode(b.eid) in unrelated, unrelated) |
4172
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
58 |
form2 = self.vreg['forms'].select('edition', self.req, entity=b) |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
59 |
unrelated = [reid for rview, reid in form2.field_by_name('tags', 'object', t.e_schema).choices(form2)] |
5914
dc5a77a2e485
[form] test update/remove deprecation warnings: form vocabulary should contains unicode values
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5873
diff
changeset
|
60 |
self.failUnless(unicode(t.eid) in unrelated, unrelated) |
1345 | 61 |
self.execute('SET X tags Y WHERE X is Tag, Y is BlogEntry') |
4172
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
62 |
unrelated = [reid for rview, reid in form1.field_by_name('tags', 'subject', t.e_schema).choices(form1)] |
5914
dc5a77a2e485
[form] test update/remove deprecation warnings: form vocabulary should contains unicode values
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5873
diff
changeset
|
63 |
self.failIf(unicode(b.eid) in unrelated, unrelated) |
4172
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
64 |
unrelated = [reid for rview, reid in form2.field_by_name('tags', 'object', t.e_schema).choices(form2)] |
5914
dc5a77a2e485
[form] test update/remove deprecation warnings: form vocabulary should contains unicode values
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5873
diff
changeset
|
65 |
self.failIf(unicode(t.eid) in unrelated, unrelated) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
66 |
|
3176
b94703b131ad
hopefully correctly fix the breadcrumbs escaping
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
3002
diff
changeset
|
67 |
|
1345 | 68 |
def test_form_field_vocabulary_new_entity(self): |
2773
b2530e3e0afb
[testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2755
diff
changeset
|
69 |
e = self.vreg['etypes'].etype_class('CWUser')(self.request()) |
4172
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
70 |
form = self.vreg['forms'].select('edition', self.req, entity=e) |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
71 |
unrelated = [rview for rview, reid in form.field_by_name('in_group', 'subject').choices(form)] |
1345 | 72 |
# should be default groups but owners, i.e. managers, users, guests |
6340
470d8e828fda
[test] update test to unittest2 api (still using lgc.testlib though)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5914
diff
changeset
|
73 |
self.assertEqual(unrelated, [u'guests', u'managers', u'users']) |
1345 | 74 |
|
1843
646c2dd1f03e
#343290: inputs don't use value specified in URL
sylvain.thenault@logilab.fr
parents:
1793
diff
changeset
|
75 |
def test_consider_req_form_params(self): |
2773
b2530e3e0afb
[testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2755
diff
changeset
|
76 |
e = self.vreg['etypes'].etype_class('CWUser')(self.request()) |
1843
646c2dd1f03e
#343290: inputs don't use value specified in URL
sylvain.thenault@logilab.fr
parents:
1793
diff
changeset
|
77 |
e.eid = 'A' |
646c2dd1f03e
#343290: inputs don't use value specified in URL
sylvain.thenault@logilab.fr
parents:
1793
diff
changeset
|
78 |
form = EntityFieldsForm(self.request(login=u'toto'), None, entity=e) |
4390 | 79 |
field = StringField(name='login', role='subject', eidparam=True) |
1843
646c2dd1f03e
#343290: inputs don't use value specified in URL
sylvain.thenault@logilab.fr
parents:
1793
diff
changeset
|
80 |
form.append_field(field) |
3510
bf746bf4a394
rename form_build_context to build_context, and call it from form, not renderer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3176
diff
changeset
|
81 |
form.build_context({}) |
6340
470d8e828fda
[test] update test to unittest2 api (still using lgc.testlib though)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5914
diff
changeset
|
82 |
self.assertEqual(field.widget.values(form, field), (u'toto',)) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
83 |
|
1947
8696403e5324
test and fix __linkto handling (#343421)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1843
diff
changeset
|
84 |
|
8696403e5324
test and fix __linkto handling (#343421)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1843
diff
changeset
|
85 |
def test_linkto_field_duplication(self): |
2773
b2530e3e0afb
[testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2755
diff
changeset
|
86 |
e = self.vreg['etypes'].etype_class('CWUser')(self.request()) |
1947
8696403e5324
test and fix __linkto handling (#343421)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1843
diff
changeset
|
87 |
e.eid = 'A' |
4172
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
88 |
e._cw = self.req |
1947
8696403e5324
test and fix __linkto handling (#343421)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1843
diff
changeset
|
89 |
geid = self.execute('CWGroup X WHERE X name "users"')[0][0] |
8696403e5324
test and fix __linkto handling (#343421)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1843
diff
changeset
|
90 |
self.req.form['__linkto'] = 'in_group:%s:subject' % geid |
2661
f8df42c9da6b
[vreg api update] remove some deprecation warnings
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2637
diff
changeset
|
91 |
form = self.vreg['forms'].select('edition', self.req, entity=e) |
1947
8696403e5324
test and fix __linkto handling (#343421)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1843
diff
changeset
|
92 |
form.content_type = 'text/html' |
3953
19aefd78f61b
[forms] deprecate form_render(**kwargs) in favor of render(formvalues=None, rendervalues=None, renderer=None)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3772
diff
changeset
|
93 |
pageinfo = self._check_html(form.render(), form, template=None) |
1947
8696403e5324
test and fix __linkto handling (#343421)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1843
diff
changeset
|
94 |
inputs = pageinfo.find_tag('select', False) |
7017
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6637
diff
changeset
|
95 |
ok = False |
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6637
diff
changeset
|
96 |
for selectnode in pageinfo.matching_nodes('select', name='from_in_group-subject:A'): |
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6637
diff
changeset
|
97 |
for optionnode in selectnode: |
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6637
diff
changeset
|
98 |
self.assertEqual(optionnode.get('value'), str(geid)) |
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6637
diff
changeset
|
99 |
self.assertEqual(ok, False) |
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6637
diff
changeset
|
100 |
ok = True |
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6637
diff
changeset
|
101 |
self.assertEqual(ok, True, 'expected option not found') |
1947
8696403e5324
test and fix __linkto handling (#343421)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1843
diff
changeset
|
102 |
inputs = pageinfo.find_tag('input', False) |
7017
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6637
diff
changeset
|
103 |
self.failIf(list(pageinfo.matching_nodes('input', name='__linkto'))) |
1947
8696403e5324
test and fix __linkto handling (#343421)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1843
diff
changeset
|
104 |
|
2198
ac45d4dbaf76
close #344264, pb with composite fields / renderer.display_fields
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2174
diff
changeset
|
105 |
def test_reledit_composite_field(self): |
ac45d4dbaf76
close #344264, pb with composite fields / renderer.display_fields
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2174
diff
changeset
|
106 |
rset = self.execute('INSERT BlogEntry X: X title "cubicweb.org", X content "hop"') |
7161
e3f69df8dac7
fix failing tests before 3.12 release
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
7017
diff
changeset
|
107 |
form = self.vreg['views'].select('reledit', self.request(), |
2661
f8df42c9da6b
[vreg api update] remove some deprecation warnings
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2637
diff
changeset
|
108 |
rset=rset, row=0, rtype='content') |
7161
e3f69df8dac7
fix failing tests before 3.12 release
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
7017
diff
changeset
|
109 |
data = form.render(row=0, rtype='content', formid='base', action='edit_rtype') |
4172
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
110 |
self.failUnless('content_format' in data) |
2198
ac45d4dbaf76
close #344264, pb with composite fields / renderer.display_fields
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2174
diff
changeset
|
111 |
|
1181
620ec8e6ae19
cleanup, various fix to get something working
sylvain.thenault@logilab.fr
parents:
1147
diff
changeset
|
112 |
# form view tests ######################################################### |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
113 |
|
1181
620ec8e6ae19
cleanup, various fix to get something working
sylvain.thenault@logilab.fr
parents:
1147
diff
changeset
|
114 |
def test_massmailing_formview(self): |
620ec8e6ae19
cleanup, various fix to get something working
sylvain.thenault@logilab.fr
parents:
1147
diff
changeset
|
115 |
self.execute('INSERT EmailAddress X: X address L + "@cubicweb.org", ' |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1393
diff
changeset
|
116 |
'U use_email X WHERE U is CWUser, U login L') |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1393
diff
changeset
|
117 |
rset = self.execute('CWUser X') |
1181
620ec8e6ae19
cleanup, various fix to get something working
sylvain.thenault@logilab.fr
parents:
1147
diff
changeset
|
118 |
self.view('massmailing', rset, template=None) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
119 |
|
1181
620ec8e6ae19
cleanup, various fix to get something working
sylvain.thenault@logilab.fr
parents:
1147
diff
changeset
|
120 |
|
1057
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
121 |
# form tests ############################################################## |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
122 |
|
869
168ad6d424d1
form to edit multiple entities, use it in DeleteConfForm
sylvain.thenault@logilab.fr
parents:
868
diff
changeset
|
123 |
def test_form_inheritance(self): |
1057
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
124 |
class CustomChangeStateForm(ChangeStateForm): |
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
125 |
hello = IntField(name='youlou') |
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
126 |
creation_date = DateTimeField(widget=DateTimePicker) |
894 | 127 |
form = CustomChangeStateForm(self.req, redirect_path='perdu.com', |
128 |
entity=self.entity) |
|
3953
19aefd78f61b
[forms] deprecate form_render(**kwargs) in favor of render(formvalues=None, rendervalues=None, renderer=None)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3772
diff
changeset
|
129 |
form.render(formvalues=dict(state=123, trcomment=u'', |
19aefd78f61b
[forms] deprecate form_render(**kwargs) in favor of render(formvalues=None, rendervalues=None, renderer=None)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3772
diff
changeset
|
130 |
trcomment_format=u'text/plain')) |
869
168ad6d424d1
form to edit multiple entities, use it in DeleteConfForm
sylvain.thenault@logilab.fr
parents:
868
diff
changeset
|
131 |
|
168ad6d424d1
form to edit multiple entities, use it in DeleteConfForm
sylvain.thenault@logilab.fr
parents:
868
diff
changeset
|
132 |
def test_change_state_form(self): |
894 | 133 |
form = ChangeStateForm(self.req, redirect_path='perdu.com', |
134 |
entity=self.entity) |
|
3953
19aefd78f61b
[forms] deprecate form_render(**kwargs) in favor of render(formvalues=None, rendervalues=None, renderer=None)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3772
diff
changeset
|
135 |
form.render(formvalues=dict(state=123, trcomment=u'', |
19aefd78f61b
[forms] deprecate form_render(**kwargs) in favor of render(formvalues=None, rendervalues=None, renderer=None)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3772
diff
changeset
|
136 |
trcomment_format=u'text/plain')) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
137 |
|
1057
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
138 |
# fields tests ############################################################ |
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
139 |
|
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
140 |
def _render_entity_field(self, name, form): |
3510
bf746bf4a394
rename form_build_context to build_context, and call it from form, not renderer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3176
diff
changeset
|
141 |
form.build_context({}) |
1995
ec95eaa2b711
turn renderers into appobjects
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1983
diff
changeset
|
142 |
renderer = FormRenderer(self.req) |
4172
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
143 |
return form.field_by_name(name, 'subject').render(form, renderer) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
144 |
|
1057
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
145 |
def _test_richtextfield(self, expected): |
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
146 |
class RTFForm(EntityFieldsForm): |
4172
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
147 |
description = RichTextField(eidparam=True, role='subject') |
4390 | 148 |
state = self.vreg['etypes'].etype_class('State')(self.req) |
149 |
state.eid = 'S' |
|
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
150 |
form = RTFForm(self.req, redirect_path='perdu.com', entity=state) |
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
151 |
# make it think it can use fck editor anyway |
6637
6bbfc628555b
[3.10] more form api update
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6340
diff
changeset
|
152 |
form.field_by_name('description', 'subject').format = lambda form, field=None: 'text/html' |
6340
470d8e828fda
[test] update test to unittest2 api (still using lgc.testlib though)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5914
diff
changeset
|
153 |
self.assertMultiLineEqual(self._render_entity_field('description', form), |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
154 |
expected % {'eid': state.eid}) |
1111
bcb81e7c41bc
fix test: form_add_entity_hiddens *must* be called before build context, resulting in slightly different outputs...
sylvain.thenault@logilab.fr
parents:
1074
diff
changeset
|
155 |
|
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
156 |
|
1057
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
157 |
def test_richtextfield_1(self): |
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
158 |
self.req.use_fckeditor = lambda: False |
4172
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
159 |
self._test_richtextfield('''<select id="description_format-subject:%(eid)s" name="description_format-subject:%(eid)s" size="1" style="display: block" tabindex="1"> |
1300 | 160 |
<option value="text/cubicweb-page-template">text/cubicweb-page-template</option> |
4172
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
161 |
<option selected="selected" value="text/html">text/html</option> |
1057
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
162 |
<option value="text/plain">text/plain</option> |
4172
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
163 |
<option value="text/rest">text/rest</option> |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
164 |
</select><textarea cols="80" id="description-subject:%(eid)s" name="description-subject:%(eid)s" onkeyup="autogrow(this)" rows="2" tabindex="2"></textarea>''') |
1111
bcb81e7c41bc
fix test: form_add_entity_hiddens *must* be called before build context, resulting in slightly different outputs...
sylvain.thenault@logilab.fr
parents:
1074
diff
changeset
|
165 |
|
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
166 |
|
1057
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
167 |
def test_richtextfield_2(self): |
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
168 |
self.req.use_fckeditor = lambda: True |
4172
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
169 |
self._test_richtextfield('<input name="description_format-subject:%(eid)s" type="hidden" value="text/html" /><textarea cols="80" cubicweb:type="wysiwyg" id="description-subject:%(eid)s" name="description-subject:%(eid)s" onkeyup="autogrow(this)" rows="2" tabindex="1"></textarea>') |
1057
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
170 |
|
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
171 |
|
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
172 |
def test_filefield(self): |
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
173 |
class FFForm(EntityFieldsForm): |
4172
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
174 |
data = FileField( |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
175 |
format_field=StringField(name='data_format', max_length=50, |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
176 |
eidparam=True, role='subject'), |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
177 |
encoding_field=StringField(name='data_encoding', max_length=20, |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
178 |
eidparam=True, role='subject'), |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
179 |
eidparam=True, role='subject') |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
180 |
file = self.req.create_entity('File', data_name=u"pouet.txt", data_encoding=u'UTF-8', |
1057
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
181 |
data=Binary('new widgets system')) |
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
182 |
form = FFForm(self.req, redirect_path='perdu.com', entity=file) |
6340
470d8e828fda
[test] update test to unittest2 api (still using lgc.testlib though)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5914
diff
changeset
|
183 |
self.assertMultiLineEqual(self._render_entity_field('data', form), |
4172
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
184 |
'''<input id="data-subject:%(eid)s" name="data-subject:%(eid)s" tabindex="1" type="file" value="" /> |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
185 |
<a href="javascript: toggleVisibility('data-subject:%(eid)s-advanced')" title="show advanced fields"><img src="http://testing.fr/cubicweb/data/puce_down.png" alt="show advanced fields"/></a> |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
186 |
<div id="data-subject:%(eid)s-advanced" class="hidden"> |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
187 |
<label for="data_format-subject:%(eid)s">data_format</label><input id="data_format-subject:%(eid)s" maxlength="50" name="data_format-subject:%(eid)s" size="45" tabindex="2" type="text" value="text/plain" /><br/> |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
188 |
<label for="data_encoding-subject:%(eid)s">data_encoding</label><input id="data_encoding-subject:%(eid)s" maxlength="20" name="data_encoding-subject:%(eid)s" size="20" tabindex="3" type="text" value="UTF-8" /><br/> |
1111
bcb81e7c41bc
fix test: form_add_entity_hiddens *must* be called before build context, resulting in slightly different outputs...
sylvain.thenault@logilab.fr
parents:
1074
diff
changeset
|
189 |
</div> |
bcb81e7c41bc
fix test: form_add_entity_hiddens *must* be called before build context, resulting in slightly different outputs...
sylvain.thenault@logilab.fr
parents:
1074
diff
changeset
|
190 |
<br/> |
4172
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
191 |
<input name="data-subject__detach:%(eid)s" type="checkbox" /> |
6340
470d8e828fda
[test] update test to unittest2 api (still using lgc.testlib though)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5914
diff
changeset
|
192 |
detach attached file''' % {'eid': file.eid}) |
1057
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
193 |
|
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
194 |
|
1057
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
195 |
def test_editablefilefield(self): |
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
196 |
class EFFForm(EntityFieldsForm): |
4172
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
197 |
data = EditableFileField( |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
198 |
format_field=StringField('data_format', max_length=50, |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
199 |
eidparam=True, role='subject'), |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
200 |
encoding_field=StringField('data_encoding', max_length=20, |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
201 |
eidparam=True, role='subject'), |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
202 |
eidparam=True, role='subject') |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
203 |
file = self.req.create_entity('File', data_name=u"pouet.txt", data_encoding=u'UTF-8', |
1057
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
204 |
data=Binary('new widgets system')) |
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
205 |
form = EFFForm(self.req, redirect_path='perdu.com', entity=file) |
6340
470d8e828fda
[test] update test to unittest2 api (still using lgc.testlib though)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5914
diff
changeset
|
206 |
self.assertMultiLineEqual(self._render_entity_field('data', form), |
4172
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
207 |
'''<input id="data-subject:%(eid)s" name="data-subject:%(eid)s" tabindex="1" type="file" value="" /> |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
208 |
<a href="javascript: toggleVisibility('data-subject:%(eid)s-advanced')" title="show advanced fields"><img src="http://testing.fr/cubicweb/data/puce_down.png" alt="show advanced fields"/></a> |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
209 |
<div id="data-subject:%(eid)s-advanced" class="hidden"> |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
210 |
<label for="data_format-subject:%(eid)s">data_format</label><input id="data_format-subject:%(eid)s" maxlength="50" name="data_format-subject:%(eid)s" size="45" tabindex="2" type="text" value="text/plain" /><br/> |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
211 |
<label for="data_encoding-subject:%(eid)s">data_encoding</label><input id="data_encoding-subject:%(eid)s" maxlength="20" name="data_encoding-subject:%(eid)s" size="20" tabindex="3" type="text" value="UTF-8" /><br/> |
1057
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
212 |
</div> |
1111
bcb81e7c41bc
fix test: form_add_entity_hiddens *must* be called before build context, resulting in slightly different outputs...
sylvain.thenault@logilab.fr
parents:
1074
diff
changeset
|
213 |
<br/> |
4172
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
214 |
<input name="data-subject__detach:%(eid)s" type="checkbox" /> |
1111
bcb81e7c41bc
fix test: form_add_entity_hiddens *must* be called before build context, resulting in slightly different outputs...
sylvain.thenault@logilab.fr
parents:
1074
diff
changeset
|
215 |
detach attached file |
1057
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
216 |
<p><b>You can either submit a new file using the browse button above, or choose to remove already uploaded file by checking the "detach attached file" check-box, or edit file content online with the widget below.</b></p> |
4172
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
217 |
<textarea cols="80" name="data-subject:%(eid)s" onkeyup="autogrow(this)" rows="3" tabindex="4">new widgets system</textarea>''' % {'eid': file.eid}) |
1111
bcb81e7c41bc
fix test: form_add_entity_hiddens *must* be called before build context, resulting in slightly different outputs...
sylvain.thenault@logilab.fr
parents:
1074
diff
changeset
|
218 |
|
1057
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
219 |
|
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
220 |
def test_passwordfield(self): |
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
221 |
class PFForm(EntityFieldsForm): |
4172
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
222 |
upassword = PasswordField(eidparam=True, role='subject') |
1057
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
223 |
form = PFForm(self.req, redirect_path='perdu.com', entity=self.entity) |
6340
470d8e828fda
[test] update test to unittest2 api (still using lgc.testlib though)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5914
diff
changeset
|
224 |
self.assertMultiLineEqual(self._render_entity_field('upassword', form), |
4678
45661175f1da
[test] no more __cubicweb_internal_field__ value displayed on password widget
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4536
diff
changeset
|
225 |
'''<input id="upassword-subject:%(eid)s" name="upassword-subject:%(eid)s" tabindex="1" type="password" value="" /> |
1057
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
226 |
<br/> |
4678
45661175f1da
[test] no more __cubicweb_internal_field__ value displayed on password widget
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4536
diff
changeset
|
227 |
<input name="upassword-subject-confirm:%(eid)s" tabindex="1" type="password" value="" /> |
2996
866a2c135c33
B #345282 xhtml requires to use   instead of
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2755
diff
changeset
|
228 |
  |
1111
bcb81e7c41bc
fix test: form_add_entity_hiddens *must* be called before build context, resulting in slightly different outputs...
sylvain.thenault@logilab.fr
parents:
1074
diff
changeset
|
229 |
<span class="emphasis">confirm password</span>''' % {'eid': self.entity.eid}) |
1057
6636c75c4aa9
actual fields test, though it's still to early for form tests
sylvain.thenault@logilab.fr
parents:
1052
diff
changeset
|
230 |
|
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
231 |
|
4172
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
232 |
# def test_datefield(self): |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
233 |
# class DFForm(EntityFieldsForm): |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
234 |
# creation_date = DateTimeField(widget=Input) |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
235 |
# form = DFForm(self.req, entity=self.entity) |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
236 |
# init, cur = (fromstring(self._render_entity_field(attr, form)).get('value') |
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3998
diff
changeset
|
237 |
# for attr in ('edits-creation_date', 'creation_date')) |
6340
470d8e828fda
[test] update test to unittest2 api (still using lgc.testlib though)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5914
diff
changeset
|
238 |
# self.assertEqual(init, cur) |
2145 | 239 |
|
845 | 240 |
if __name__ == '__main__': |
241 |
unittest_main() |