author | Julien Cristau <julien.cristau@logilab.fr> |
Thu, 03 Jul 2014 12:18:34 +0200 | |
changeset 9867 | 7f36f31d8828 |
parent 9811 | 25ba231d2910 |
child 9977 | e48e5a597ccc |
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""" |
20 |
||
783 | 21 |
from logilab.common.testlib import unittest_main |
793 | 22 |
|
2773
b2530e3e0afb
[testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2657
diff
changeset
|
23 |
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
|
24 |
from cubicweb import Binary, UnknownProperty |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
25 |
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
|
26 |
specified_etype_implements, rql_condition) |
793 | 27 |
from cubicweb.web import NoSelectableObject |
0 | 28 |
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
|
29 |
|
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
30 |
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
|
31 |
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
|
32 |
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
|
33 |
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
|
34 |
undohistory) |
0 | 35 |
|
3229
948e0cb59b1a
test update
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2780
diff
changeset
|
36 |
from cubes.folder import views as folderviews |
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 |
f7c07e9d4f2e
[web test] make unittest_viewselectors work if rdflib isn't available
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
8292
diff
changeset
|
52 |
RDFVIEWS = [('rdf', rdf.RDFView)] |
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: |
8696
0bb18407c053
[toward py3k] rewrite dict.keys() and dict.values() (part of #2711624)
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
8645
diff
changeset
|
80 |
print registry, sorted(expected), sorted(content) |
0bb18407c053
[toward py3k] rewrite dict.keys() and dict.values() (part of #2711624)
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
8645
diff
changeset
|
81 |
print 'no more', [v for v in expected if not v in content] |
0bb18407c053
[toward py3k] rewrite dict.keys() and dict.values() (part of #2711624)
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
8645
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 |
('tree', folderviews.FolderTreeView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
105 |
('undohistory', undohistory.UndoHistoryView)]) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
106 |
|
793 | 107 |
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
|
108 |
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
|
109 |
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
|
110 |
self.assertListEqual([('jsonexport', json.JsonRsetView)], |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
111 |
self.pviews(req, rset)) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
112 |
|
793 | 113 |
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
|
114 |
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
|
115 |
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
|
116 |
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
|
117 |
[('csvexport', csvexport.CSVRsetView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
118 |
('ecsvexport', csvexport.CSVEntityView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
119 |
('ejsonexport', json.JsonEntityView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
120 |
('filetree', treeview.FileTreeView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
121 |
('jsonexport', json.JsonRsetView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
122 |
('list', baseviews.ListView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
123 |
('oneline', baseviews.OneLineView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
124 |
('owlabox', owl.OWLABOXView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
125 |
('primary', cwuser.CWGroupPrimaryView)] + \ |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
126 |
RDFVIEWS + \ |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
127 |
[('rsetxml', xmlrss.XMLRsetView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
128 |
('rss', xmlrss.RSSView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
129 |
('sameetypelist', baseviews.SameETypeListView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
130 |
('security', management.SecurityManagementView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
131 |
('table', tableview.RsetTableView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
132 |
('text', baseviews.TextView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
133 |
('treeview', treeview.TreeView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
134 |
('xbel', xbel.XbelView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
135 |
('xml', xmlrss.XMLView)]) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
136 |
|
793 | 137 |
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
|
138 |
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
|
139 |
rset = req.execute('CWGroup X') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
140 |
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
|
141 |
[('csvexport', csvexport.CSVRsetView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
142 |
('ecsvexport', csvexport.CSVEntityView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
143 |
('ejsonexport', json.JsonEntityView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
144 |
('filetree', treeview.FileTreeView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
145 |
('jsonexport', json.JsonRsetView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
146 |
('list', baseviews.ListView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
147 |
('oneline', baseviews.OneLineView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
148 |
('owlabox', owl.OWLABOXView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
149 |
('primary', cwuser.CWGroupPrimaryView)] + RDFVIEWS + [ |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
150 |
('rsetxml', xmlrss.XMLRsetView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
151 |
('rss', xmlrss.RSSView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
152 |
('sameetypelist', baseviews.SameETypeListView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
153 |
('security', management.SecurityManagementView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
154 |
('table', tableview.RsetTableView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
155 |
('text', baseviews.TextView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
156 |
('treeview', treeview.TreeView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
157 |
('xbel', xbel.XbelView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
158 |
('xml', xmlrss.XMLView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
159 |
]) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
160 |
|
2401
890f6b990dd7
[views] epropertiesform renamed propertiesform
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
161 |
def test_propertiesform_admin(self): |
2403
74f7fa676a52
fix typo, remove debug
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2401
diff
changeset
|
162 |
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
|
163 |
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
|
164 |
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
|
165 |
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
|
166 |
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
|
167 |
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
|
168 |
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
|
169 |
|
890f6b990dd7
[views] epropertiesform renamed propertiesform
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
170 |
def test_propertiesform_anon(self): |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
171 |
with self.new_access('anon').web_request() as req: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
172 |
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
|
173 |
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
|
174 |
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
|
175 |
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
|
176 |
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
|
177 |
|
890f6b990dd7
[views] epropertiesform renamed propertiesform
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
178 |
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
|
179 |
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
|
180 |
self.create_user(cnx, 'jdoe') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
181 |
cnx.commit() |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
182 |
with self.new_access('jdoe').web_request() as req: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
183 |
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
|
184 |
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
|
185 |
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
|
186 |
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
|
187 |
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
|
188 |
|
793 | 189 |
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
|
190 |
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
|
191 |
rset = req.execute('Any X') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
192 |
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
|
193 |
[('csvexport', csvexport.CSVRsetView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
194 |
('ecsvexport', csvexport.CSVEntityView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
195 |
('ejsonexport', json.JsonEntityView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
196 |
('filetree', treeview.FileTreeView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
197 |
('jsonexport', json.JsonRsetView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
198 |
('list', baseviews.ListView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
199 |
('oneline', baseviews.OneLineView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
200 |
('owlabox', owl.OWLABOXView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
201 |
('primary', primary.PrimaryView),] + RDFVIEWS + [ |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
202 |
('rsetxml', xmlrss.XMLRsetView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
203 |
('rss', xmlrss.RSSView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
204 |
('security', management.SecurityManagementView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
205 |
('table', tableview.RsetTableView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
206 |
('text', baseviews.TextView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
207 |
('treeview', treeview.TreeView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
208 |
('xbel', xbel.XbelView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
209 |
('xml', xmlrss.XMLView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
210 |
]) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
211 |
|
793 | 212 |
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
|
213 |
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
|
214 |
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
|
215 |
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
|
216 |
[('csvexport', csvexport.CSVRsetView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
217 |
('jsonexport', json.JsonRsetView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
218 |
('rsetxml', xmlrss.XMLRsetView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
219 |
('table', tableview.RsetTableView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
220 |
]) |
793 | 221 |
|
222 |
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
|
223 |
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
|
224 |
rset = req.execute('CWUser X') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
225 |
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
|
226 |
[('csvexport', csvexport.CSVRsetView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
227 |
('ecsvexport', csvexport.CSVEntityView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
228 |
('ejsonexport', json.JsonEntityView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
229 |
('filetree', treeview.FileTreeView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
230 |
('foaf', cwuser.FoafView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
231 |
('jsonexport', json.JsonRsetView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
232 |
('list', baseviews.ListView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
233 |
('oneline', baseviews.OneLineView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
234 |
('owlabox', owl.OWLABOXView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
235 |
('primary', primary.PrimaryView)] + RDFVIEWS + [ |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
236 |
('rsetxml', xmlrss.XMLRsetView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
237 |
('rss', xmlrss.RSSView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
238 |
('sameetypelist', baseviews.SameETypeListView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
239 |
('security', management.SecurityManagementView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
240 |
('table', tableview.RsetTableView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
241 |
('text', baseviews.TextView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
242 |
('treeview', treeview.TreeView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
243 |
('vcard', vcard.VCardCWUserView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
244 |
('xbel', xbel.XbelView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
245 |
('xml', xmlrss.XMLView), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
246 |
]) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
247 |
|
0 | 248 |
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
|
249 |
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
|
250 |
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
|
251 |
{'useractions': USERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
252 |
'siteactions': SITEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
253 |
'manage': MANAGEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
254 |
'footer': FOOTERACTIONS}) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
255 |
|
0 | 256 |
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
|
257 |
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
|
258 |
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
|
259 |
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
|
260 |
{'useractions': USERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
261 |
'siteactions': SITEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
262 |
'manage': MANAGEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
263 |
'footer': FOOTERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
264 |
}) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
265 |
|
0 | 266 |
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
|
267 |
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
|
268 |
rset = req.execute('CWGroup X') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
269 |
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
|
270 |
{'useractions': USERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
271 |
'siteactions': SITEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
272 |
'manage': MANAGEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
273 |
'footer': FOOTERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
274 |
'mainactions': [actions.MultipleEditAction], |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
275 |
'moreactions': [actions.DeleteAction, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
276 |
actions.AddNewAction]}) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
277 |
|
0 | 278 |
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
|
279 |
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
|
280 |
rset = req.execute('Any X') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
281 |
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
|
282 |
{'useractions': USERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
283 |
'siteactions': SITEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
284 |
'manage': MANAGEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
285 |
'footer': FOOTERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
286 |
'moreactions': [actions.DeleteAction], |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
287 |
}) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
288 |
|
0 | 289 |
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
|
290 |
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
|
291 |
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
|
292 |
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
|
293 |
{'useractions': USERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
294 |
'siteactions': SITEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
295 |
'manage': MANAGEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
296 |
'footer': FOOTERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
297 |
}) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
298 |
|
1654 | 299 |
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
|
300 |
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
|
301 |
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
|
302 |
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
|
303 |
{'useractions': USERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
304 |
'siteactions': SITEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
305 |
'manage': MANAGEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
306 |
'footer': FOOTERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
307 |
'mainactions': [actions.ModifyAction, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
308 |
actions.ViewSameCWEType], |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
309 |
'moreactions': [actions.ManagePermissionsAction, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
310 |
actions.AddRelatedActions, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
311 |
actions.DeleteAction, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
312 |
actions.CopyAction, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
313 |
], |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
314 |
}) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
315 |
|
0 | 316 |
|
317 |
def test_select_creation_form(self): |
|
318 |
rset = None |
|
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
319 |
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
|
320 |
# creation form |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
321 |
req.form['etype'] = 'CWGroup' |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
322 |
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
|
323 |
editforms.CreationFormView) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
324 |
|
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 |
# custom creation form |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
327 |
class CWUserCreationForm(editforms.CreationFormView): |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
328 |
__select__ = specified_etype_implements('CWUser') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
329 |
|
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
330 |
self.vreg._loadedmods[__name__] = {} |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
331 |
self.vreg.register(CWUserCreationForm) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
332 |
req.form['etype'] = 'CWUser' |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
333 |
|
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
334 |
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
|
335 |
CWUserCreationForm) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
336 |
|
0 | 337 |
def test_select_view(self): |
338 |
# no entity |
|
339 |
rset = None |
|
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
340 |
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
|
341 |
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
|
342 |
startup.IndexView) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
343 |
self.assertRaises(NoSelectableObject, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
344 |
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
|
345 |
self.assertRaises(NoSelectableObject, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
346 |
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
|
347 |
|
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
348 |
# no entity |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
349 |
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
|
350 |
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
|
351 |
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
|
352 |
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
|
353 |
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
|
354 |
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
|
355 |
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
|
356 |
self.assertRaises(NoSelectableObject, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
357 |
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
|
358 |
# one entity |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
359 |
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
|
360 |
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
|
361 |
primary.PrimaryView) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
362 |
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
|
363 |
baseviews.ListView) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
364 |
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
|
365 |
editforms.EditionFormView) |
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('table', req, rset=rset), |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
367 |
tableview.RsetTableView) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
368 |
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
|
369 |
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
|
370 |
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
|
371 |
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
|
372 |
# 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
|
373 |
rset = req.execute('CWGroup X') |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
374 |
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
|
375 |
primary.PrimaryView) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
376 |
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
|
377 |
baseviews.ListView) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
378 |
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
|
379 |
tableview.RsetTableView) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
380 |
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
|
381 |
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
|
382 |
# 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
|
383 |
rset = req.execute('Any X') |
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('primary', req, rset=rset), |
1654 | 385 |
primary.PrimaryView) |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
386 |
self.assertIsInstance(self.vreg['views'].select('list', req, rset=rset), |
0 | 387 |
baseviews.ListView) |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
388 |
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
|
389 |
tableview.RsetTableView) |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
390 |
self.assertRaises(NoSelectableObject, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
391 |
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
|
392 |
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
|
393 |
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
|
394 |
# whatever |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
395 |
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
|
396 |
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
|
397 |
tableview.RsetTableView) |
9811
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 |
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
|
401 |
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
|
402 |
self.assertRaises(NoSelectableObject, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
403 |
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
|
404 |
self.assertRaises(NoSelectableObject, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
405 |
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
|
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, 'edition', req, rset=rset) |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
408 |
# mixed query |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
409 |
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
|
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, 'edition', 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, 'creation', req, rset=rset) |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
414 |
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
|
415 |
tableview.RsetTableView) |
0 | 416 |
|
417 |
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
|
418 |
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
|
419 |
req.create_entity('File', data_name=u'bim.png', data=Binary('bim')) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
420 |
# image primary view priority |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
421 |
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
|
422 |
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
|
423 |
idownloadable.IDownloadablePrimaryView) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
424 |
|
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
425 |
|
0 | 426 |
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
|
427 |
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
|
428 |
req.create_entity('File', data_name=u'bim.png', data=Binary('bim')) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
429 |
# image/ehtml primary view priority |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
430 |
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
|
431 |
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
|
432 |
idownloadable.ImageView) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
433 |
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
|
434 |
|
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
435 |
fileobj = req.create_entity('File', data_name=u'bim.html', data=Binary('<html>bam</html')) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
436 |
# image/ehtml primary view priority |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
437 |
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
|
438 |
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
|
439 |
idownloadable.EHTMLView) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
440 |
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
|
441 |
|
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
442 |
fileobj = req.create_entity('File', data_name=u'bim.txt', data=Binary('boum')) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
443 |
# image/ehtml primary view priority |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
444 |
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
|
445 |
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
|
446 |
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
|
447 |
|
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
448 |
|
0 | 449 |
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
|
450 |
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
|
451 |
if rql is None: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
452 |
rset = None |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
453 |
else: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
454 |
rset = req.execute(rql) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
455 |
try: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
456 |
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
|
457 |
return obj.render(**args) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
458 |
except Exception: |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
459 |
print vid, rset, args |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
460 |
raise |
0 | 461 |
|
462 |
def test_form(self): |
|
463 |
for vid, rql, args in ( |
|
464 |
#('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
|
465 |
('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
|
466 |
('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
|
467 |
('muledit', 'CWGroup X', {}), |
0 | 468 |
#('muledit', 'Any X', {}), |
469 |
): |
|
470 |
self._test_view(vid, rql, args) |
|
471 |
||
472 |
||
473 |
def test_properties(self): |
|
8696
0bb18407c053
[toward py3k] rewrite dict.keys() and dict.values() (part of #2711624)
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
8645
diff
changeset
|
474 |
self.assertEqual(sorted(k for k in self.vreg['propertydefs'].iterkeys() |
0bb18407c053
[toward py3k] rewrite dict.keys() and dict.values() (part of #2711624)
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
8645
diff
changeset
|
475 |
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
|
476 |
['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
|
477 |
'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
|
478 |
'ctxcomponents.edit_box.visible']) |
0bb18407c053
[toward py3k] rewrite dict.keys() and dict.values() (part of #2711624)
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
8645
diff
changeset
|
479 |
self.assertEqual([k for k in self.vreg['propertyvalues'].iterkeys() |
0bb18407c053
[toward py3k] rewrite dict.keys() and dict.values() (part of #2711624)
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
8645
diff
changeset
|
480 |
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
|
481 |
[]) |
6367
d4c485ec1ca1
fix merge, some buffers weren't saved...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
482 |
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
|
483 |
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
|
484 |
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
|
485 |
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
|
486 |
self.assertRaises(UnknownProperty, self.vreg.property_value, 'ctxcomponents.actions_box') |
0 | 487 |
|
488 |
||
489 |
||
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
793
diff
changeset
|
490 |
class CWETypeRQLAction(Action): |
3408
c92170fca813
[api] use __regid__ instead of deprecated id
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3230
diff
changeset
|
491 |
__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
|
492 |
__select__ = is_instance('CWEType') & rql_condition('X name "CWEType"') |
0 | 493 |
title = 'bla' |
494 |
||
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
495 |
|
0 | 496 |
class RQLActionTC(ViewSelectorTC): |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
497 |
|
0 | 498 |
def setUp(self): |
499 |
super(RQLActionTC, self).setUp() |
|
1654 | 500 |
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
|
501 |
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
|
502 |
actionsreg = self.vreg['actions'] |
4534 | 503 |
actionsreg['testaction'][0].__registered__(actionsreg) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
504 |
|
0 | 505 |
def tearDown(self): |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
506 |
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
|
507 |
del self.vreg['actions']['testaction'] |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
508 |
|
0 | 509 |
def test(self): |
9811
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
510 |
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
|
511 |
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
|
512 |
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
|
513 |
{'useractions': USERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
514 |
'siteactions': SITEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
515 |
'footer': FOOTERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
516 |
'manage': MANAGEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
517 |
'mainactions': [actions.ModifyAction, actions.ViewSameCWEType], |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
518 |
'moreactions': [actions.ManagePermissionsAction, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
519 |
actions.AddRelatedActions, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
520 |
actions.DeleteAction, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
521 |
actions.CopyAction, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
522 |
CWETypeRQLAction, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
523 |
], |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
524 |
}) |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
525 |
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
|
526 |
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
|
527 |
{'useractions': USERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
528 |
'siteactions': SITEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
529 |
'footer': FOOTERACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
530 |
'manage': MANAGEACTIONS, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
531 |
'mainactions': [actions.ModifyAction, actions.ViewSameCWEType], |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
532 |
'moreactions': [actions.ManagePermissionsAction, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
533 |
actions.AddRelatedActions, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
534 |
actions.DeleteAction, |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
535 |
actions.CopyAction,] |
25ba231d2910
[webtests/views_selectors] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8908
diff
changeset
|
536 |
}) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
537 |
|
0 | 538 |
|
539 |
||
540 |
if __name__ == '__main__': |
|
541 |
unittest_main() |