author | Rémi Cardona <remi.cardona@logilab.fr> |
Fri, 18 Sep 2015 11:58:29 +0200 | |
changeset 10707 | 3f4f190f8e35 |
parent 10704 | 73367a56ee41 |
permissions | -rw-r--r-- |
2401
890f6b990dd7
[views] epropertiesform renamed propertiesform
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
1 |
# -*- coding: utf-8 -*- |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
2 |
# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4916
diff
changeset
|
3 |
# 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:
4916
diff
changeset
|
4 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4916
diff
changeset
|
5 |
# 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:
4916
diff
changeset
|
6 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4916
diff
changeset
|
7 |
# 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:
4916
diff
changeset
|
8 |
# 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:
4916
diff
changeset
|
9 |
# 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:
4916
diff
changeset
|
10 |
# 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:
4916
diff
changeset
|
11 |
# |
5424
8ecbcbff9777
replace logilab-common by CubicWeb in disclaimer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5421
diff
changeset
|
12 |
# 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:
4916
diff
changeset
|
13 |
# 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:
4916
diff
changeset
|
14 |
# 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:
4916
diff
changeset
|
15 |
# details. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4916
diff
changeset
|
16 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4916
diff
changeset
|
17 |
# 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:
4916
diff
changeset
|
18 |
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
5886 | 19 |
"""XXX rename, split, reorganize this""" |
10589
7c23b7de2b8d
[py3k] print function
Samuel Trégouët <samuel.tregouet@logilab.fr>
parents:
10319
diff
changeset
|
20 |
from __future__ import print_function |
5886 | 21 |
|
783 | 22 |
from logilab.common.testlib import unittest_main |
793 | 23 |
|
2773
b2530e3e0afb
[testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2657
diff
changeset
|
24 |
from cubicweb.devtools.testlib import CubicWebTC |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
25 |
from cubicweb import Binary, UnknownProperty |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
26 |
from cubicweb.predicates import (is_instance, |
8190
2a3c1b787688
[vreg] move base registry implementation to logilab.common. Closes #1916014
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7994
diff
changeset
|
27 |
specified_etype_implements, rql_condition) |
793 | 28 |
from cubicweb.web import NoSelectableObject |
0 | 29 |
from cubicweb.web.action import Action |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
30 |
|
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
31 |
from cubicweb.web.views import (primary, baseviews, tableview, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
32 |
editforms, management, actions, startup, cwuser, schema, xbel, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
33 |
vcard, owl, treeview, idownloadable, wdoc, debug, cwuser, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
34 |
cwproperties, cwsources, xmlrss, rdf, csvexport, json, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
35 |
undohistory) |
0 | 36 |
|
3229
948e0cb59b1a
test update
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2780
diff
changeset
|
37 |
|
3468
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
38 |
USERACTIONS = [actions.UserPreferencesAction, |
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
39 |
actions.UserInfoAction, |
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
40 |
actions.LogoutAction] |
7017
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
41 |
SITEACTIONS = [actions.ManageAction] |
3998
94cc7cad3d2d
backport stable into default
Sylvain Thénault <sylvain.thenault@logilab.fr>
diff
changeset
|
42 |
FOOTERACTIONS = [wdoc.HelpAction, |
3589 | 43 |
wdoc.AboutAction, |
44 |
actions.PoweredByAction] |
|
7017
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
45 |
MANAGEACTIONS = [actions.SiteConfigurationAction, |
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
46 |
schema.ViewSchemaAction, |
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
47 |
cwuser.ManageUsersAction, |
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
48 |
cwsources.ManageSourcesAction, |
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
49 |
debug.SiteInfoAction] |
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
50 |
|
8591
f7c07e9d4f2e
[web test] make unittest_viewselectors work if rdflib isn't available
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
8292
diff
changeset
|
51 |
if hasattr(rdf, 'RDFView'): # not available if rdflib not installed |
10319
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
52 |
RDFVIEWS = [('rdf', rdf.RDFView), ('n3rdf', rdf.RDFN3View)] |
8591
f7c07e9d4f2e
[web test] make unittest_viewselectors work if rdflib isn't available
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
8292
diff
changeset
|
53 |
else: |
f7c07e9d4f2e
[web test] make unittest_viewselectors work if rdflib isn't available
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
8292
diff
changeset
|
54 |
RDFVIEWS = [] |
f7c07e9d4f2e
[web test] make unittest_viewselectors work if rdflib isn't available
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
8292
diff
changeset
|
55 |
|
2773
b2530e3e0afb
[testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2657
diff
changeset
|
56 |
class ViewSelectorTC(CubicWebTC): |
0 | 57 |
|
58 |
def setup_database(self): |
|
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
59 |
with self.admin_access.repo_cnx() as cnx: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
60 |
cnx.create_entity('BlogEntry', title=u"une news !", content=u"cubicweb c'est beau") |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
61 |
cnx.create_entity('Bookmark', title=u"un signet !", path=u"view?vid=index") |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
62 |
cnx.create_entity('EmailAddress', address=u"devel@logilab.fr", alias=u'devel') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
63 |
cnx.create_entity('Tag', name=u'x') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
64 |
cnx.commit() |
0 | 65 |
|
66 |
class VRegistryTC(ViewSelectorTC): |
|
67 |
"""test the view selector""" |
|
68 |
||
69 |
def _test_registered(self, registry, content): |
|
70 |
try: |
|
71 |
expected = getattr(self, 'all_%s' % registry) |
|
72 |
except AttributeError: |
|
73 |
return |
|
74 |
if registry == 'hooks': |
|
6340
470d8e828fda
[test] update test to unittest2 api (still using lgc.testlib though)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6048
diff
changeset
|
75 |
self.assertEqual(len(content), expected, content) |
0 | 76 |
return |
77 |
try: |
|
8696
0bb18407c053
[toward py3k] rewrite dict.keys() and dict.values() (part of #2711624)
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
8645
diff
changeset
|
78 |
self.assertSetEqual(list(content), expected) |
7815
2a164a9cf81c
[exceptions] stop catching any exception in various places (closes #1942716)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7244
diff
changeset
|
79 |
except Exception: |
10589
7c23b7de2b8d
[py3k] print function
Samuel Trégouët <samuel.tregouet@logilab.fr>
parents:
10319
diff
changeset
|
80 |
print(registry, sorted(expected), sorted(content)) |
7c23b7de2b8d
[py3k] print function
Samuel Trégouët <samuel.tregouet@logilab.fr>
parents:
10319
diff
changeset
|
81 |
print('no more', [v for v in expected if not v in content]) |
7c23b7de2b8d
[py3k] print function
Samuel Trégouët <samuel.tregouet@logilab.fr>
parents:
10319
diff
changeset
|
82 |
print('missing', [v for v in content if not v in expected]) |
0 | 83 |
raise |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
84 |
|
2403
74f7fa676a52
fix typo, remove debug
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2401
diff
changeset
|
85 |
def setUp(self): |
74f7fa676a52
fix typo, remove debug
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2401
diff
changeset
|
86 |
super(VRegistryTC, self).setUp() |
74f7fa676a52
fix typo, remove debug
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2401
diff
changeset
|
87 |
assert self.vreg['views']['propertiesform'] |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
88 |
|
793 | 89 |
def test_possible_views_none_rset(self): |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
90 |
with self.admin_access.web_request() as req: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
91 |
self.assertListEqual(self.pviews(req, None), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
92 |
[('cw.sources-management', cwsources.CWSourcesManagementView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
93 |
('cw.users-and-groups-management', cwuser.UsersAndGroupsManagementView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
94 |
('gc', debug.GCView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
95 |
('index', startup.IndexView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
96 |
('info', debug.ProcessInformationView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
97 |
('manage', startup.ManageView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
98 |
('owl', owl.OWLView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
99 |
('propertiesform', cwproperties.CWPropertiesForm), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
100 |
('registry', debug.RegistryView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
101 |
('schema', schema.SchemaView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
102 |
('siteinfo', debug.SiteInfoView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
103 |
('systempropertiesform', cwproperties.SystemCWPropertiesForm), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
104 |
('undohistory', undohistory.UndoHistoryView)]) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
105 |
|
793 | 106 |
def test_possible_views_noresult(self): |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
107 |
with self.admin_access.web_request() as req: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
108 |
rset = req.execute('Any X WHERE X eid 999999') |
9977
e48e5a597ccc
[views] csvexport accept an empty rset (closes #4236928)
Damien Garaud <damien.garaud@logilab.fr>
parents:
9811
diff
changeset
|
109 |
self.assertListEqual(self.pviews(req, rset), |
e48e5a597ccc
[views] csvexport accept an empty rset (closes #4236928)
Damien Garaud <damien.garaud@logilab.fr>
parents:
9811
diff
changeset
|
110 |
[('csvexport', csvexport.CSVRsetView), |
e48e5a597ccc
[views] csvexport accept an empty rset (closes #4236928)
Damien Garaud <damien.garaud@logilab.fr>
parents:
9811
diff
changeset
|
111 |
('ecsvexport', csvexport.CSVEntityView), |
10013
b68088082280
[web/json] an empty rset is just fine for ejsonexport
Julien Cristau <julien.cristau@logilab.fr>
parents:
9977
diff
changeset
|
112 |
('ejsonexport', json.JsonEntityView), |
9977
e48e5a597ccc
[views] csvexport accept an empty rset (closes #4236928)
Damien Garaud <damien.garaud@logilab.fr>
parents:
9811
diff
changeset
|
113 |
('jsonexport', json.JsonRsetView), |
e48e5a597ccc
[views] csvexport accept an empty rset (closes #4236928)
Damien Garaud <damien.garaud@logilab.fr>
parents:
9811
diff
changeset
|
114 |
]) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
115 |
|
793 | 116 |
def test_possible_views_one_egroup(self): |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
117 |
with self.admin_access.web_request() as req: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
118 |
rset = req.execute('CWGroup X WHERE X name "managers"') |
10319
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
119 |
self.assertCountEqual(self.pviews(req, rset), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
120 |
RDFVIEWS + |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
121 |
[('csvexport', csvexport.CSVRsetView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
122 |
('ecsvexport', csvexport.CSVEntityView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
123 |
('ejsonexport', json.JsonEntityView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
124 |
('filetree', treeview.FileTreeView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
125 |
('jsonexport', json.JsonRsetView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
126 |
('list', baseviews.ListView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
127 |
('oneline', baseviews.OneLineView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
128 |
('owlabox', owl.OWLABOXView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
129 |
('primary', cwuser.CWGroupPrimaryView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
130 |
('rsetxml', xmlrss.XMLRsetView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
131 |
('rss', xmlrss.RSSView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
132 |
('sameetypelist', baseviews.SameETypeListView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
133 |
('security', management.SecurityManagementView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
134 |
('table', tableview.RsetTableView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
135 |
('text', baseviews.TextView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
136 |
('treeview', treeview.TreeView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
137 |
('xbel', xbel.XbelView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
138 |
('xml', xmlrss.XMLView)]) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
139 |
|
793 | 140 |
def test_possible_views_multiple_egroups(self): |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
141 |
with self.admin_access.web_request() as req: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
142 |
rset = req.execute('CWGroup X') |
10319
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
143 |
self.assertCountEqual(self.pviews(req, rset), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
144 |
RDFVIEWS + |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
145 |
[('csvexport', csvexport.CSVRsetView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
146 |
('ecsvexport', csvexport.CSVEntityView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
147 |
('ejsonexport', json.JsonEntityView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
148 |
('filetree', treeview.FileTreeView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
149 |
('jsonexport', json.JsonRsetView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
150 |
('list', baseviews.ListView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
151 |
('oneline', baseviews.OneLineView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
152 |
('owlabox', owl.OWLABOXView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
153 |
('primary', cwuser.CWGroupPrimaryView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
154 |
('rsetxml', xmlrss.XMLRsetView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
155 |
('rss', xmlrss.RSSView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
156 |
('sameetypelist', baseviews.SameETypeListView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
157 |
('security', management.SecurityManagementView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
158 |
('table', tableview.RsetTableView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
159 |
('text', baseviews.TextView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
160 |
('treeview', treeview.TreeView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
161 |
('xbel', xbel.XbelView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
162 |
('xml', xmlrss.XMLView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
163 |
]) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
164 |
|
2401
890f6b990dd7
[views] epropertiesform renamed propertiesform
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
165 |
def test_propertiesform_admin(self): |
2403
74f7fa676a52
fix typo, remove debug
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2401
diff
changeset
|
166 |
assert self.vreg['views']['propertiesform'] |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
167 |
with self.admin_access.web_request() as req: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
168 |
rset1 = req.execute('CWUser X WHERE X login "admin"') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
169 |
self.assertTrue(self.vreg['views'].select('propertiesform', req, rset=None)) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
170 |
self.assertTrue(self.vreg['views'].select('propertiesform', req, rset=rset1)) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
171 |
rset2 = req.execute('CWUser X WHERE X login "anon"') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
172 |
self.assertTrue(self.vreg['views'].select('propertiesform', req, rset=rset2)) |
2401
890f6b990dd7
[views] epropertiesform renamed propertiesform
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
173 |
|
890f6b990dd7
[views] epropertiesform renamed propertiesform
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
174 |
def test_propertiesform_anon(self): |
10247
7efcfb87b924
[web/test] use unicode object as user login
Julien Cristau <julien.cristau@logilab.fr>
parents:
10074
diff
changeset
|
175 |
with self.new_access(u'anon').web_request() as req: |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
176 |
rset1 = req.execute('CWUser X WHERE X login "admin"') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
177 |
self.assertRaises(NoSelectableObject, self.vreg['views'].select, 'propertiesform', req, rset=None) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
178 |
self.assertRaises(NoSelectableObject, self.vreg['views'].select, 'propertiesform', req, rset=rset1) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
179 |
rset2 = req.execute('CWUser X WHERE X login "anon"') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
180 |
self.assertRaises(NoSelectableObject, self.vreg['views'].select, 'propertiesform', req, rset=rset2) |
2401
890f6b990dd7
[views] epropertiesform renamed propertiesform
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
181 |
|
890f6b990dd7
[views] epropertiesform renamed propertiesform
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
182 |
def test_propertiesform_jdoe(self): |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
183 |
with self.admin_access.repo_cnx() as cnx: |
10247
7efcfb87b924
[web/test] use unicode object as user login
Julien Cristau <julien.cristau@logilab.fr>
parents:
10074
diff
changeset
|
184 |
self.create_user(cnx, u'jdoe') |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
185 |
cnx.commit() |
10247
7efcfb87b924
[web/test] use unicode object as user login
Julien Cristau <julien.cristau@logilab.fr>
parents:
10074
diff
changeset
|
186 |
with self.new_access(u'jdoe').web_request() as req: |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
187 |
rset1 = req.execute('CWUser X WHERE X login "admin"') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
188 |
rset2 = req.execute('CWUser X WHERE X login "jdoe"') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
189 |
self.assertTrue(self.vreg['views'].select('propertiesform', req, rset=None)) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
190 |
self.assertRaises(NoSelectableObject, self.vreg['views'].select, 'propertiesform', req, rset=rset1) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
191 |
self.assertTrue(self.vreg['views'].select('propertiesform', req, rset=rset2)) |
2401
890f6b990dd7
[views] epropertiesform renamed propertiesform
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
192 |
|
793 | 193 |
def test_possible_views_multiple_different_types(self): |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
194 |
with self.admin_access.web_request() as req: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
195 |
rset = req.execute('Any X') |
10319
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
196 |
self.assertCountEqual(self.pviews(req, rset), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
197 |
RDFVIEWS + |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
198 |
[('csvexport', csvexport.CSVRsetView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
199 |
('ecsvexport', csvexport.CSVEntityView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
200 |
('ejsonexport', json.JsonEntityView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
201 |
('filetree', treeview.FileTreeView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
202 |
('jsonexport', json.JsonRsetView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
203 |
('list', baseviews.ListView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
204 |
('oneline', baseviews.OneLineView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
205 |
('owlabox', owl.OWLABOXView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
206 |
('primary', primary.PrimaryView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
207 |
('rsetxml', xmlrss.XMLRsetView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
208 |
('rss', xmlrss.RSSView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
209 |
('security', management.SecurityManagementView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
210 |
('table', tableview.RsetTableView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
211 |
('text', baseviews.TextView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
212 |
('treeview', treeview.TreeView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
213 |
('xbel', xbel.XbelView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
214 |
('xml', xmlrss.XMLView), |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
215 |
]) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
216 |
|
793 | 217 |
def test_possible_views_any_rset(self): |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
218 |
with self.admin_access.web_request() as req: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
219 |
rset = req.execute('Any N, X WHERE X in_group Y, Y name N') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
220 |
self.assertListEqual(self.pviews(req, rset), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
221 |
[('csvexport', csvexport.CSVRsetView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
222 |
('jsonexport', json.JsonRsetView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
223 |
('rsetxml', xmlrss.XMLRsetView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
224 |
('table', tableview.RsetTableView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
225 |
]) |
793 | 226 |
|
227 |
def test_possible_views_multiple_eusers(self): |
|
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
228 |
with self.admin_access.web_request() as req: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
229 |
rset = req.execute('CWUser X') |
10319
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
230 |
self.assertCountEqual(self.pviews(req, rset), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
231 |
RDFVIEWS + |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
232 |
[('csvexport', csvexport.CSVRsetView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
233 |
('ecsvexport', csvexport.CSVEntityView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
234 |
('ejsonexport', json.JsonEntityView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
235 |
('filetree', treeview.FileTreeView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
236 |
('foaf', cwuser.FoafView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
237 |
('jsonexport', json.JsonRsetView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
238 |
('list', baseviews.ListView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
239 |
('oneline', baseviews.OneLineView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
240 |
('owlabox', owl.OWLABOXView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
241 |
('primary', primary.PrimaryView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
242 |
('rsetxml', xmlrss.XMLRsetView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
243 |
('rss', xmlrss.RSSView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
244 |
('sameetypelist', baseviews.SameETypeListView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
245 |
('security', management.SecurityManagementView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
246 |
('table', tableview.RsetTableView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
247 |
('text', baseviews.TextView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
248 |
('treeview', treeview.TreeView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
249 |
('vcard', vcard.VCardCWUserView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
250 |
('xbel', xbel.XbelView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
251 |
('xml', xmlrss.XMLView), |
0d3ede4865a8
[web/test] Fix broken tests after commit b81adb5e32f9
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10302
diff
changeset
|
252 |
]) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
253 |
|
0 | 254 |
def test_possible_actions_none_rset(self): |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
255 |
with self.admin_access.web_request() as req: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
256 |
self.assertDictEqual(self.pactionsdict(req, None, skipcategories=()), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
257 |
{'useractions': USERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
258 |
'siteactions': SITEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
259 |
'manage': MANAGEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
260 |
'footer': FOOTERACTIONS}) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
261 |
|
0 | 262 |
def test_possible_actions_no_entity(self): |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
263 |
with self.admin_access.web_request() as req: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
264 |
rset = req.execute('Any X WHERE X eid 999999') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
265 |
self.assertDictEqual(self.pactionsdict(req, rset, skipcategories=()), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
266 |
{'useractions': USERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
267 |
'siteactions': SITEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
268 |
'manage': MANAGEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
269 |
'footer': FOOTERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
270 |
}) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
271 |
|
0 | 272 |
def test_possible_actions_same_type_entities(self): |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
273 |
with self.admin_access.web_request() as req: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
274 |
rset = req.execute('CWGroup X') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
275 |
self.assertDictEqual(self.pactionsdict(req, rset, skipcategories=()), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
276 |
{'useractions': USERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
277 |
'siteactions': SITEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
278 |
'manage': MANAGEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
279 |
'footer': FOOTERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
280 |
'mainactions': [actions.MultipleEditAction], |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
281 |
'moreactions': [actions.DeleteAction, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
282 |
actions.AddNewAction]}) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
283 |
|
0 | 284 |
def test_possible_actions_different_types_entities(self): |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
285 |
with self.admin_access.web_request() as req: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
286 |
rset = req.execute('Any X') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
287 |
self.assertDictEqual(self.pactionsdict(req, rset, skipcategories=()), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
288 |
{'useractions': USERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
289 |
'siteactions': SITEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
290 |
'manage': MANAGEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
291 |
'footer': FOOTERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
292 |
'moreactions': [actions.DeleteAction], |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
293 |
}) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
294 |
|
0 | 295 |
def test_possible_actions_final_entities(self): |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
296 |
with self.admin_access.web_request() as req: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
297 |
rset = req.execute('Any N, X WHERE X in_group Y, Y name N') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
298 |
self.assertDictEqual(self.pactionsdict(req, rset, skipcategories=()), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
299 |
{'useractions': USERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
300 |
'siteactions': SITEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
301 |
'manage': MANAGEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
302 |
'footer': FOOTERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
303 |
}) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
304 |
|
1654 | 305 |
def test_possible_actions_eetype_cwuser_entity(self): |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
306 |
with self.admin_access.web_request() as req: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
307 |
rset = req.execute('CWEType X WHERE X name "CWUser"') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
308 |
self.assertDictEqual(self.pactionsdict(req, rset, skipcategories=()), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
309 |
{'useractions': USERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
310 |
'siteactions': SITEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
311 |
'manage': MANAGEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
312 |
'footer': FOOTERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
313 |
'mainactions': [actions.ModifyAction, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
314 |
actions.ViewSameCWEType], |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
315 |
'moreactions': [actions.ManagePermissionsAction, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
316 |
actions.AddRelatedActions, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
317 |
actions.DeleteAction, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
318 |
actions.CopyAction, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
319 |
], |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
320 |
}) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
321 |
|
0 | 322 |
|
323 |
def test_select_creation_form(self): |
|
324 |
rset = None |
|
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
325 |
with self.admin_access.web_request() as req: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
326 |
# creation form |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
327 |
req.form['etype'] = 'CWGroup' |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
328 |
self.assertIsInstance(self.vreg['views'].select('creation', req, rset=rset), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
329 |
editforms.CreationFormView) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
330 |
|
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
331 |
with self.admin_access.web_request() as req: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
332 |
# custom creation form |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
333 |
class CWUserCreationForm(editforms.CreationFormView): |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
334 |
__select__ = specified_etype_implements('CWUser') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
335 |
|
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
336 |
self.vreg._loadedmods[__name__] = {} |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
337 |
self.vreg.register(CWUserCreationForm) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
338 |
req.form['etype'] = 'CWUser' |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
339 |
|
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
340 |
self.assertIsInstance(self.vreg['views'].select('creation', req, rset=rset), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
341 |
CWUserCreationForm) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
342 |
|
0 | 343 |
def test_select_view(self): |
344 |
# no entity |
|
345 |
rset = None |
|
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
346 |
with self.admin_access.web_request() as req: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
347 |
self.assertIsInstance(self.vreg['views'].select('index', req, rset=rset), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
348 |
startup.IndexView) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
349 |
self.assertRaises(NoSelectableObject, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
350 |
self.vreg['views'].select, 'primary', req, rset=rset) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
351 |
self.assertRaises(NoSelectableObject, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
352 |
self.vreg['views'].select, 'table', req, rset=rset) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
353 |
|
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
354 |
# no entity |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
355 |
rset = req.execute('Any X WHERE X eid 999999') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
356 |
self.assertRaises(NoSelectableObject, |
2650
18aec79ec3a3
R [vreg] important refactoring of the vregistry, moving behaviour to end dictionnary (and so leaving room for more flexibility ; keep bw compat ; update api usage in cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2643
diff
changeset
|
357 |
self.vreg['views'].select, 'index', req, rset=rset) |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
358 |
self.assertRaises(NoSelectableObject, |
2650
18aec79ec3a3
R [vreg] important refactoring of the vregistry, moving behaviour to end dictionnary (and so leaving room for more flexibility ; keep bw compat ; update api usage in cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2643
diff
changeset
|
359 |
self.vreg['views'].select, 'creation', req, rset=rset) |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
360 |
self.assertRaises(NoSelectableObject, |
2650
18aec79ec3a3
R [vreg] important refactoring of the vregistry, moving behaviour to end dictionnary (and so leaving room for more flexibility ; keep bw compat ; update api usage in cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2643
diff
changeset
|
361 |
self.vreg['views'].select, 'primary', req, rset=rset) |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
362 |
self.assertRaises(NoSelectableObject, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
363 |
self.vreg['views'].select, 'table', req, rset=rset) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
364 |
# one entity |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
365 |
rset = req.execute('CWGroup X WHERE X name "managers"') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
366 |
self.assertIsInstance(self.vreg['views'].select('primary', req, rset=rset), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
367 |
primary.PrimaryView) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
368 |
self.assertIsInstance(self.vreg['views'].select('list', req, rset=rset), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
369 |
baseviews.ListView) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
370 |
self.assertIsInstance(self.vreg['views'].select('edition', req, rset=rset), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
371 |
editforms.EditionFormView) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
372 |
self.assertIsInstance(self.vreg['views'].select('table', req, rset=rset), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
373 |
tableview.RsetTableView) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
374 |
self.assertRaises(NoSelectableObject, |
2650
18aec79ec3a3
R [vreg] important refactoring of the vregistry, moving behaviour to end dictionnary (and so leaving room for more flexibility ; keep bw compat ; update api usage in cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2643
diff
changeset
|
375 |
self.vreg['views'].select, 'creation', req, rset=rset) |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
376 |
self.assertRaises(NoSelectableObject, |
2650
18aec79ec3a3
R [vreg] important refactoring of the vregistry, moving behaviour to end dictionnary (and so leaving room for more flexibility ; keep bw compat ; update api usage in cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2643
diff
changeset
|
377 |
self.vreg['views'].select, 'index', req, rset=rset) |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
378 |
# list of entities of the same type |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
379 |
rset = req.execute('CWGroup X') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
380 |
self.assertIsInstance(self.vreg['views'].select('primary', req, rset=rset), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
381 |
primary.PrimaryView) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
382 |
self.assertIsInstance(self.vreg['views'].select('list', req, rset=rset), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
383 |
baseviews.ListView) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
384 |
self.assertIsInstance(self.vreg['views'].select('table', req, rset=rset), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
385 |
tableview.RsetTableView) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
386 |
self.assertRaises(NoSelectableObject, |
2650
18aec79ec3a3
R [vreg] important refactoring of the vregistry, moving behaviour to end dictionnary (and so leaving room for more flexibility ; keep bw compat ; update api usage in cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2643
diff
changeset
|
387 |
self.vreg['views'].select, 'creation', req, rset=rset) |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
388 |
# list of entities of different types |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
389 |
rset = req.execute('Any X') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
390 |
self.assertIsInstance(self.vreg['views'].select('primary', req, rset=rset), |
1654 | 391 |
primary.PrimaryView) |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
392 |
self.assertIsInstance(self.vreg['views'].select('list', req, rset=rset), |
0 | 393 |
baseviews.ListView) |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
394 |
self.assertIsInstance(self.vreg['views'].select('table', req, rset=rset), |
7992
4ff9f25cb06e
[table views] closes #1986413: refactor TableView, EntityAttributesTableView, PyValTableView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7845
diff
changeset
|
395 |
tableview.RsetTableView) |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
396 |
self.assertRaises(NoSelectableObject, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
397 |
self.vreg['views'].select, 'creation', req, rset=rset) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
398 |
self.assertRaises(NoSelectableObject, |
2650
18aec79ec3a3
R [vreg] important refactoring of the vregistry, moving behaviour to end dictionnary (and so leaving room for more flexibility ; keep bw compat ; update api usage in cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2643
diff
changeset
|
399 |
self.vreg['views'].select, 'index', req, rset=rset) |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
400 |
# whatever |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
401 |
rset = req.execute('Any N, X WHERE X in_group Y, Y name N') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
402 |
self.assertIsInstance(self.vreg['views'].select('table', req, rset=rset), |
7992
4ff9f25cb06e
[table views] closes #1986413: refactor TableView, EntityAttributesTableView, PyValTableView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7845
diff
changeset
|
403 |
tableview.RsetTableView) |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
404 |
self.assertRaises(NoSelectableObject, |
2650
18aec79ec3a3
R [vreg] important refactoring of the vregistry, moving behaviour to end dictionnary (and so leaving room for more flexibility ; keep bw compat ; update api usage in cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2643
diff
changeset
|
405 |
self.vreg['views'].select, 'index', req, rset=rset) |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
406 |
self.assertRaises(NoSelectableObject, |
2650
18aec79ec3a3
R [vreg] important refactoring of the vregistry, moving behaviour to end dictionnary (and so leaving room for more flexibility ; keep bw compat ; update api usage in cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2643
diff
changeset
|
407 |
self.vreg['views'].select, 'creation', req, rset=rset) |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
408 |
self.assertRaises(NoSelectableObject, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
409 |
self.vreg['views'].select, 'primary', req, rset=rset) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
410 |
self.assertRaises(NoSelectableObject, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
411 |
self.vreg['views'].select, 'list', req, rset=rset) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
412 |
self.assertRaises(NoSelectableObject, |
2650
18aec79ec3a3
R [vreg] important refactoring of the vregistry, moving behaviour to end dictionnary (and so leaving room for more flexibility ; keep bw compat ; update api usage in cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2643
diff
changeset
|
413 |
self.vreg['views'].select, 'edition', req, rset=rset) |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
414 |
# mixed query |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
415 |
rset = req.execute('Any U,G WHERE U is CWUser, G is CWGroup') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
416 |
self.assertRaises(NoSelectableObject, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
417 |
self.vreg['views'].select, 'edition', req, rset=rset) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
418 |
self.assertRaises(NoSelectableObject, |
2650
18aec79ec3a3
R [vreg] important refactoring of the vregistry, moving behaviour to end dictionnary (and so leaving room for more flexibility ; keep bw compat ; update api usage in cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2643
diff
changeset
|
419 |
self.vreg['views'].select, 'creation', req, rset=rset) |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
420 |
self.assertIsInstance(self.vreg['views'].select('table', req, rset=rset), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
421 |
tableview.RsetTableView) |
0 | 422 |
|
423 |
def test_interface_selector(self): |
|
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
424 |
with self.admin_access.web_request() as req: |
10704
73367a56ee41
[py3k] ensure Binary objects are initialized with bytes
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10664
diff
changeset
|
425 |
req.create_entity('File', data_name=u'bim.png', data=Binary(b'bim')) |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
426 |
# image primary view priority |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
427 |
rset = req.execute('File X WHERE X data_name "bim.png"') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
428 |
self.assertIsInstance(self.vreg['views'].select('primary', req, rset=rset), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
429 |
idownloadable.IDownloadablePrimaryView) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
430 |
|
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
431 |
|
0 | 432 |
def test_score_entity_selector(self): |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
433 |
with self.admin_access.web_request() as req: |
10704
73367a56ee41
[py3k] ensure Binary objects are initialized with bytes
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10664
diff
changeset
|
434 |
req.create_entity('File', data_name=u'bim.png', data=Binary(b'bim')) |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
435 |
# image/ehtml primary view priority |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
436 |
rset = req.execute('File X WHERE X data_name "bim.png"') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
437 |
self.assertIsInstance(self.vreg['views'].select('image', req, rset=rset), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
438 |
idownloadable.ImageView) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
439 |
self.assertRaises(NoSelectableObject, self.vreg['views'].select, 'ehtml', req, rset=rset) |
6048
4695b1ee58a0
fix idownload view pb. for xhtml browsers
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6031
diff
changeset
|
440 |
|
10704
73367a56ee41
[py3k] ensure Binary objects are initialized with bytes
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10664
diff
changeset
|
441 |
fileobj = req.create_entity('File', data_name=u'bim.html', data=Binary(b'<html>bam</html')) |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
442 |
# image/ehtml primary view priority |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
443 |
rset = req.execute('File X WHERE X data_name "bim.html"') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
444 |
self.assertIsInstance(self.vreg['views'].select('ehtml', req, rset=rset), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
445 |
idownloadable.EHTMLView) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
446 |
self.assertRaises(NoSelectableObject, self.vreg['views'].select, 'image', req, rset=rset) |
6048
4695b1ee58a0
fix idownload view pb. for xhtml browsers
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6031
diff
changeset
|
447 |
|
10704
73367a56ee41
[py3k] ensure Binary objects are initialized with bytes
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10664
diff
changeset
|
448 |
fileobj = req.create_entity('File', data_name=u'bim.txt', data=Binary(b'boum')) |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
449 |
# image/ehtml primary view priority |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
450 |
rset = req.execute('File X WHERE X data_name "bim.txt"') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
451 |
self.assertRaises(NoSelectableObject, self.vreg['views'].select, 'image', req, rset=rset) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
452 |
self.assertRaises(NoSelectableObject, self.vreg['views'].select, 'ehtml', req, rset=rset) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
453 |
|
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
454 |
|
0 | 455 |
def _test_view(self, vid, rql, args): |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
456 |
with self.admin_access.web_request() as req: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
457 |
if rql is None: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
458 |
rset = None |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
459 |
else: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
460 |
rset = req.execute(rql) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
461 |
try: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
462 |
obj = self.vreg['views'].select(vid, req, rset=rset, **args) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
463 |
return obj.render(**args) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
464 |
except Exception: |
10589
7c23b7de2b8d
[py3k] print function
Samuel Trégouët <samuel.tregouet@logilab.fr>
parents:
10319
diff
changeset
|
465 |
print(vid, rset, args) |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
466 |
raise |
0 | 467 |
|
468 |
def test_form(self): |
|
469 |
for vid, rql, args in ( |
|
470 |
#('creation', 'Any X WHERE X eid 999999', {}), |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
793
diff
changeset
|
471 |
('edition', 'CWGroup X WHERE X name "managers"', {}), |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
793
diff
changeset
|
472 |
('copy', 'CWGroup X WHERE X name "managers"', {}), |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
793
diff
changeset
|
473 |
('muledit', 'CWGroup X', {}), |
0 | 474 |
#('muledit', 'Any X', {}), |
475 |
): |
|
476 |
self._test_view(vid, rql, args) |
|
477 |
||
478 |
||
479 |
def test_properties(self): |
|
10664
6465a3e9d7ac
[py3k] dict.iterkeys → dict
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10589
diff
changeset
|
480 |
self.assertEqual(sorted(k for k in self.vreg['propertydefs'] |
8696
0bb18407c053
[toward py3k] rewrite dict.keys() and dict.values() (part of #2711624)
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
8645
diff
changeset
|
481 |
if k.startswith('ctxcomponents.edit_box')), |
0bb18407c053
[toward py3k] rewrite dict.keys() and dict.values() (part of #2711624)
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
8645
diff
changeset
|
482 |
['ctxcomponents.edit_box.context', |
0bb18407c053
[toward py3k] rewrite dict.keys() and dict.values() (part of #2711624)
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
8645
diff
changeset
|
483 |
'ctxcomponents.edit_box.order', |
0bb18407c053
[toward py3k] rewrite dict.keys() and dict.values() (part of #2711624)
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
8645
diff
changeset
|
484 |
'ctxcomponents.edit_box.visible']) |
10664
6465a3e9d7ac
[py3k] dict.iterkeys → dict
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10589
diff
changeset
|
485 |
self.assertEqual([k for k in self.vreg['propertyvalues'] |
8696
0bb18407c053
[toward py3k] rewrite dict.keys() and dict.values() (part of #2711624)
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
8645
diff
changeset
|
486 |
if not k.startswith('system.version')], |
0bb18407c053
[toward py3k] rewrite dict.keys() and dict.values() (part of #2711624)
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
8645
diff
changeset
|
487 |
[]) |
6367
d4c485ec1ca1
fix merge, some buffers weren't saved...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
488 |
self.assertEqual(self.vreg.property_value('ctxcomponents.edit_box.visible'), True) |
d4c485ec1ca1
fix merge, some buffers weren't saved...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
489 |
self.assertEqual(self.vreg.property_value('ctxcomponents.edit_box.order'), 2) |
d4c485ec1ca1
fix merge, some buffers weren't saved...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
490 |
self.assertEqual(self.vreg.property_value('ctxcomponents.possible_views_box.visible'), False) |
d4c485ec1ca1
fix merge, some buffers weren't saved...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
491 |
self.assertEqual(self.vreg.property_value('ctxcomponents.possible_views_box.order'), 10) |
6141
b8287e54b528
[web api] unify 'contentnav' (VComponent) and 'boxes' registries as 'ctxcomponents' (CtxComponent)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6048
diff
changeset
|
492 |
self.assertRaises(UnknownProperty, self.vreg.property_value, 'ctxcomponents.actions_box') |
0 | 493 |
|
494 |
||
495 |
||
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
793
diff
changeset
|
496 |
class CWETypeRQLAction(Action): |
3408
c92170fca813
[api] use __regid__ instead of deprecated id
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3230
diff
changeset
|
497 |
__regid__ = 'testaction' |
5877
0c7b7b76a84f
[selectors] provide a new, optimized, is_instance selector that should at some point replace implements (along with the adaptable selector)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5570
diff
changeset
|
498 |
__select__ = is_instance('CWEType') & rql_condition('X name "CWEType"') |
0 | 499 |
title = 'bla' |
500 |
||
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
501 |
|
0 | 502 |
class RQLActionTC(ViewSelectorTC): |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
503 |
|
0 | 504 |
def setUp(self): |
505 |
super(RQLActionTC, self).setUp() |
|
1654 | 506 |
self.vreg._loadedmods[__name__] = {} |
4491
a0f48c31b58a
kill register_appobject_class method, simplifying autoregistration. Update test accordingly (test which manually registers object should also properly call there __register__ method). Drop the disable-appobjects config file entry: no one used it since its introduction years ago.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4182
diff
changeset
|
507 |
self.vreg.register(CWETypeRQLAction) |
a0f48c31b58a
kill register_appobject_class method, simplifying autoregistration. Update test accordingly (test which manually registers object should also properly call there __register__ method). Drop the disable-appobjects config file entry: no one used it since its introduction years ago.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4182
diff
changeset
|
508 |
actionsreg = self.vreg['actions'] |
4534 | 509 |
actionsreg['testaction'][0].__registered__(actionsreg) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
510 |
|
0 | 511 |
def tearDown(self): |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
512 |
super(RQLActionTC, self).tearDown() |
2650
18aec79ec3a3
R [vreg] important refactoring of the vregistry, moving behaviour to end dictionnary (and so leaving room for more flexibility ; keep bw compat ; update api usage in cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2643
diff
changeset
|
513 |
del self.vreg['actions']['testaction'] |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
514 |
|
0 | 515 |
def test(self): |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
516 |
with self.admin_access.web_request() as req: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
517 |
rset = req.execute('CWEType X WHERE X name "CWEType"') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
518 |
self.assertDictEqual(self.pactionsdict(req, rset, skipcategories=()), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
519 |
{'useractions': USERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
520 |
'siteactions': SITEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
521 |
'footer': FOOTERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
522 |
'manage': MANAGEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
523 |
'mainactions': [actions.ModifyAction, actions.ViewSameCWEType], |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
524 |
'moreactions': [actions.ManagePermissionsAction, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
525 |
actions.AddRelatedActions, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
526 |
actions.DeleteAction, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
527 |
actions.CopyAction, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
528 |
CWETypeRQLAction, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
529 |
], |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
530 |
}) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
531 |
rset = req.execute('CWEType X WHERE X name "CWRType"') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
532 |
self.assertDictEqual(self.pactionsdict(req, rset, skipcategories=()), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
533 |
{'useractions': USERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
534 |
'siteactions': SITEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
535 |
'footer': FOOTERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
536 |
'manage': MANAGEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
537 |
'mainactions': [actions.ModifyAction, actions.ViewSameCWEType], |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
538 |
'moreactions': [actions.ManagePermissionsAction, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
539 |
actions.AddRelatedActions, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
540 |
actions.DeleteAction, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
541 |
actions.CopyAction,] |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
542 |
}) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
543 |
|
0 | 544 |
|
545 |
||
546 |
if __name__ == '__main__': |
|
547 |
unittest_main() |