author | Aurelien Campeas <aurelien.campeas@logilab.fr> |
Mon, 17 Dec 2012 14:26:41 +0100 | |
branch | stable |
changeset 8633 | 36197bd1d78b |
parent 8591 | f7c07e9d4f2e |
child 8632 | fa044b9157d7 |
child 8641 | 459d0c48dfaf |
permissions | -rw-r--r-- |
2401
890f6b990dd7
[views] epropertiesform renamed propertiesform
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
1 |
# -*- coding: utf-8 -*- |
8190
2a3c1b787688
[vreg] move base registry implementation to logilab.common. Closes #1916014
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7994
diff
changeset
|
2 |
# copyright 2003-2012 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 |
4493
c0a43c6ba777
now raise UnknownProperty, not KeyError
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4492
diff
changeset
|
24 |
from cubicweb import CW_SOFTWARE_ROOT as BASE, Binary, UnknownProperty |
8190
2a3c1b787688
[vreg] move base registry implementation to logilab.common. Closes #1916014
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7994
diff
changeset
|
25 |
from cubicweb.predicates import (match_user_groups, is_instance, |
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 |
7017
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
29 |
from cubicweb.web.views import ( |
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
30 |
primary, baseviews, tableview, editforms, calendar, management, embedding, |
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
31 |
actions, startup, cwuser, schema, xbel, vcard, owl, treeview, idownloadable, |
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
32 |
wdoc, debug, cwuser, cwproperties, cwsources, workflow, xmlrss, rdf, |
8292
6f2de09b29e8
[undo, test] fix undohistory selector et related tests
Florent Cayré <florent.cayre@logilab.fr>
parents:
8190
diff
changeset
|
33 |
csvexport, json, undohistory) |
0 | 34 |
|
3229
948e0cb59b1a
test update
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2780
diff
changeset
|
35 |
from cubes.folder import views as folderviews |
948e0cb59b1a
test update
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2780
diff
changeset
|
36 |
|
3468
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
37 |
USERACTIONS = [actions.UserPreferencesAction, |
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
38 |
actions.UserInfoAction, |
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
39 |
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
|
40 |
SITEACTIONS = [actions.ManageAction] |
3998
94cc7cad3d2d
backport stable into default
Sylvain Thénault <sylvain.thenault@logilab.fr>
diff
changeset
|
41 |
FOOTERACTIONS = [wdoc.HelpAction, |
94cc7cad3d2d
backport stable into default
Sylvain Thénault <sylvain.thenault@logilab.fr>
diff
changeset
|
42 |
wdoc.ChangeLogAction, |
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 |
|
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
51 |
if hasattr(rdf, 'RDFView') is not None: # not available if rdf lib not installed |
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
52 |
RDFVIEWS = [('rdf', rdf.RDFView)] |
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
53 |
|
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
54 |
assert RDFVIEWS |
0 | 55 |
|
8591
f7c07e9d4f2e
[web test] make unittest_viewselectors work if rdflib isn't available
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
8292
diff
changeset
|
56 |
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
|
57 |
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
|
58 |
else: |
f7c07e9d4f2e
[web test] make unittest_viewselectors work if rdflib isn't available
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
8292
diff
changeset
|
59 |
RDFVIEWS = [] |
f7c07e9d4f2e
[web test] make unittest_viewselectors work if rdflib isn't available
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
8292
diff
changeset
|
60 |
|
2773
b2530e3e0afb
[testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2657
diff
changeset
|
61 |
class ViewSelectorTC(CubicWebTC): |
0 | 62 |
|
63 |
def setup_database(self): |
|
4078 | 64 |
req = self.request() |
65 |
req.create_entity('BlogEntry', title=u"une news !", content=u"cubicweb c'est beau") |
|
66 |
req.create_entity('Bookmark', title=u"un signet !", path=u"view?vid=index") |
|
67 |
req.create_entity('EmailAddress', address=u"devel@logilab.fr", alias=u'devel') |
|
68 |
req.create_entity('Tag', name=u'x') |
|
0 | 69 |
|
70 |
class VRegistryTC(ViewSelectorTC): |
|
71 |
"""test the view selector""" |
|
72 |
||
73 |
def _test_registered(self, registry, content): |
|
74 |
try: |
|
75 |
expected = getattr(self, 'all_%s' % registry) |
|
76 |
except AttributeError: |
|
77 |
return |
|
78 |
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
|
79 |
self.assertEqual(len(content), expected, content) |
0 | 80 |
return |
81 |
try: |
|
82 |
self.assertSetEqual(content.keys(), expected) |
|
7815
2a164a9cf81c
[exceptions] stop catching any exception in various places (closes #1942716)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7244
diff
changeset
|
83 |
except Exception: |
0 | 84 |
print registry, sorted(expected), sorted(content.keys()) |
85 |
print 'no more', [v for v in expected if not v in content.keys()] |
|
86 |
print 'missing', [v for v in content.keys() if not v in expected] |
|
87 |
raise |
|
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
88 |
|
2403
74f7fa676a52
fix typo, remove debug
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2401
diff
changeset
|
89 |
def setUp(self): |
74f7fa676a52
fix typo, remove debug
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2401
diff
changeset
|
90 |
super(VRegistryTC, self).setUp() |
74f7fa676a52
fix typo, remove debug
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2401
diff
changeset
|
91 |
assert self.vreg['views']['propertiesform'] |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
92 |
|
793 | 93 |
def test_possible_views_none_rset(self): |
0 | 94 |
req = self.request() |
95 |
self.assertListEqual(self.pviews(req, None), |
|
96 |
[('changelog', wdoc.ChangeLogView), |
|
7994
af3fb709c061
[management table] upgrade sources groups management table to new api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7992
diff
changeset
|
97 |
('cw.sources-management', cwsources.CWSourcesManagementView), |
7802
d0bf71aff4a1
[web test] fix test broken by new users/groups management views
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7792
diff
changeset
|
98 |
('cw.users-and-groups-management', cwuser.UsersAndGroupsManagementView), |
4916 | 99 |
('gc', debug.GCView), |
0 | 100 |
('index', startup.IndexView), |
4724
fe1f3c560381
fix test, broken by the merge of debug and info views
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4534
diff
changeset
|
101 |
('info', debug.ProcessInformationView), |
0 | 102 |
('manage', startup.ManageView), |
587
c8ff5d88f164
adding views to test
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents:
479
diff
changeset
|
103 |
('owl', owl.OWLView), |
1900
8dd4bb69c73d
[tests] fix test after eproperties got renamed to cwproperties
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1797
diff
changeset
|
104 |
('propertiesform', cwproperties.CWPropertiesForm), |
3468
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
105 |
('registry', debug.RegistryView), |
2643
9976f511003b
web test update
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2458
diff
changeset
|
106 |
('schema', schema.SchemaView), |
7017
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
107 |
('siteinfo', debug.SiteInfoView), |
3229
948e0cb59b1a
test update
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2780
diff
changeset
|
108 |
('systempropertiesform', cwproperties.SystemCWPropertiesForm), |
948e0cb59b1a
test update
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2780
diff
changeset
|
109 |
('tree', folderviews.FolderTreeView), |
8292
6f2de09b29e8
[undo, test] fix undohistory selector et related tests
Florent Cayré <florent.cayre@logilab.fr>
parents:
8190
diff
changeset
|
110 |
('undohistory', undohistory.UndoHistoryView), |
3229
948e0cb59b1a
test update
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2780
diff
changeset
|
111 |
]) |
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_noresult(self): |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
114 |
req = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
115 |
rset = req.execute('Any X WHERE X eid 999999') |
0 | 116 |
self.assertListEqual(self.pviews(req, rset), |
783 | 117 |
[]) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
118 |
|
793 | 119 |
def test_possible_views_one_egroup(self): |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
120 |
req = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
121 |
rset = req.execute('CWGroup X WHERE X name "managers"') |
0 | 122 |
self.assertListEqual(self.pviews(req, rset), |
4494
ccb7fce7297b
AdaptedList -> SameETypeList
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4493
diff
changeset
|
123 |
[('csvexport', csvexport.CSVRsetView), |
1654 | 124 |
('ecsvexport', csvexport.CSVEntityView), |
7992
4ff9f25cb06e
[table views] closes #1986413: refactor TableView, EntityAttributesTableView, PyValTableView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7845
diff
changeset
|
125 |
('ejsonexport', json.JsonEntityView), |
444 | 126 |
('filetree', treeview.FileTreeView), |
7992
4ff9f25cb06e
[table views] closes #1986413: refactor TableView, EntityAttributesTableView, PyValTableView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7845
diff
changeset
|
127 |
('jsonexport', json.JsonRsetView), |
0 | 128 |
('list', baseviews.ListView), |
129 |
('oneline', baseviews.OneLineView), |
|
587
c8ff5d88f164
adding views to test
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents:
479
diff
changeset
|
130 |
('owlabox', owl.OWLABOXView), |
7017
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
131 |
('primary', cwuser.CWGroupPrimaryView)] + RDFVIEWS + [ |
1654 | 132 |
('rsetxml', xmlrss.XMLRsetView), |
133 |
('rss', xmlrss.RSSView), |
|
4494
ccb7fce7297b
AdaptedList -> SameETypeList
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4493
diff
changeset
|
134 |
('sameetypelist', baseviews.SameETypeListView), |
0 | 135 |
('security', management.SecurityManagementView), |
7992
4ff9f25cb06e
[table views] closes #1986413: refactor TableView, EntityAttributesTableView, PyValTableView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7845
diff
changeset
|
136 |
('table', tableview.RsetTableView), |
0 | 137 |
('text', baseviews.TextView), |
444 | 138 |
('treeview', treeview.TreeView), |
0 | 139 |
('xbel', xbel.XbelView), |
1654 | 140 |
('xml', xmlrss.XMLView), |
0 | 141 |
]) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
142 |
|
793 | 143 |
def test_possible_views_multiple_egroups(self): |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
144 |
req = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
145 |
rset = req.execute('CWGroup X') |
0 | 146 |
self.assertListEqual(self.pviews(req, rset), |
4494
ccb7fce7297b
AdaptedList -> SameETypeList
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4493
diff
changeset
|
147 |
[('csvexport', csvexport.CSVRsetView), |
1654 | 148 |
('ecsvexport', csvexport.CSVEntityView), |
7992
4ff9f25cb06e
[table views] closes #1986413: refactor TableView, EntityAttributesTableView, PyValTableView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7845
diff
changeset
|
149 |
('ejsonexport', json.JsonEntityView), |
444 | 150 |
('filetree', treeview.FileTreeView), |
7992
4ff9f25cb06e
[table views] closes #1986413: refactor TableView, EntityAttributesTableView, PyValTableView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7845
diff
changeset
|
151 |
('jsonexport', json.JsonRsetView), |
0 | 152 |
('list', baseviews.ListView), |
153 |
('oneline', baseviews.OneLineView), |
|
587
c8ff5d88f164
adding views to test
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents:
479
diff
changeset
|
154 |
('owlabox', owl.OWLABOXView), |
7017
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
155 |
('primary', cwuser.CWGroupPrimaryView)] + RDFVIEWS + [ |
1654 | 156 |
('rsetxml', xmlrss.XMLRsetView), |
157 |
('rss', xmlrss.RSSView), |
|
4494
ccb7fce7297b
AdaptedList -> SameETypeList
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4493
diff
changeset
|
158 |
('sameetypelist', baseviews.SameETypeListView), |
0 | 159 |
('security', management.SecurityManagementView), |
7992
4ff9f25cb06e
[table views] closes #1986413: refactor TableView, EntityAttributesTableView, PyValTableView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7845
diff
changeset
|
160 |
('table', tableview.RsetTableView), |
0 | 161 |
('text', baseviews.TextView), |
444 | 162 |
('treeview', treeview.TreeView), |
0 | 163 |
('xbel', xbel.XbelView), |
1654 | 164 |
('xml', xmlrss.XMLView), |
0 | 165 |
]) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
166 |
|
2401
890f6b990dd7
[views] epropertiesform renamed propertiesform
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
167 |
def test_propertiesform_admin(self): |
2403
74f7fa676a52
fix typo, remove debug
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2401
diff
changeset
|
168 |
assert self.vreg['views']['propertiesform'] |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
169 |
req1 = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
170 |
req2 = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
171 |
rset1 = req1.execute('CWUser X WHERE X login "admin"') |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
172 |
rset2 = req2.execute('CWUser X WHERE X login "anon"') |
7791
31bb51ea5485
[deprecation] fix unittest pending deprecation warnings on failIf/failUnless methods family
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7244
diff
changeset
|
173 |
self.assertTrue(self.vreg['views'].select('propertiesform', req1, rset=None)) |
31bb51ea5485
[deprecation] fix unittest pending deprecation warnings on failIf/failUnless methods family
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7244
diff
changeset
|
174 |
self.assertTrue(self.vreg['views'].select('propertiesform', req1, rset=rset1)) |
31bb51ea5485
[deprecation] fix unittest pending deprecation warnings on failIf/failUnless methods family
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7244
diff
changeset
|
175 |
self.assertTrue(self.vreg['views'].select('propertiesform', req2, rset=rset2)) |
2401
890f6b990dd7
[views] epropertiesform renamed propertiesform
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
176 |
|
890f6b990dd7
[views] epropertiesform renamed propertiesform
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
177 |
def test_propertiesform_anon(self): |
890f6b990dd7
[views] epropertiesform renamed propertiesform
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
178 |
self.login('anon') |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
179 |
req1 = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
180 |
req2 = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
181 |
rset1 = req1.execute('CWUser X WHERE X login "admin"') |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
182 |
rset2 = req2.execute('CWUser X WHERE X login "anon"') |
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
|
183 |
self.assertRaises(NoSelectableObject, self.vreg['views'].select, 'propertiesform', req1, rset=None) |
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
|
184 |
self.assertRaises(NoSelectableObject, self.vreg['views'].select, 'propertiesform', req1, rset=rset1) |
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
|
185 |
self.assertRaises(NoSelectableObject, self.vreg['views'].select, 'propertiesform', req1, rset=rset2) |
2401
890f6b990dd7
[views] epropertiesform renamed propertiesform
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
186 |
|
890f6b990dd7
[views] epropertiesform renamed propertiesform
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
187 |
def test_propertiesform_jdoe(self): |
7244
a918f76441ce
fix tests broken by fcb8932082a5 (continued)
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
7017
diff
changeset
|
188 |
self.create_user(self.request(), 'jdoe') |
2401
890f6b990dd7
[views] epropertiesform renamed propertiesform
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
189 |
self.login('jdoe') |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
190 |
req1 = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
191 |
req2 = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
192 |
rset1 = req1.execute('CWUser X WHERE X login "admin"') |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
193 |
rset2 = req2.execute('CWUser X WHERE X login "jdoe"') |
7791
31bb51ea5485
[deprecation] fix unittest pending deprecation warnings on failIf/failUnless methods family
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7244
diff
changeset
|
194 |
self.assertTrue(self.vreg['views'].select('propertiesform', req1, rset=None)) |
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
|
195 |
self.assertRaises(NoSelectableObject, self.vreg['views'].select, 'propertiesform', req1, rset=rset1) |
7791
31bb51ea5485
[deprecation] fix unittest pending deprecation warnings on failIf/failUnless methods family
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7244
diff
changeset
|
196 |
self.assertTrue(self.vreg['views'].select('propertiesform', req2, rset=rset2)) |
2401
890f6b990dd7
[views] epropertiesform renamed propertiesform
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
197 |
|
793 | 198 |
def test_possible_views_multiple_different_types(self): |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
199 |
req = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
200 |
rset = req.execute('Any X') |
0 | 201 |
self.assertListEqual(self.pviews(req, rset), |
1654 | 202 |
[('csvexport', csvexport.CSVRsetView), |
203 |
('ecsvexport', csvexport.CSVEntityView), |
|
7992
4ff9f25cb06e
[table views] closes #1986413: refactor TableView, EntityAttributesTableView, PyValTableView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7845
diff
changeset
|
204 |
('ejsonexport', json.JsonEntityView), |
444 | 205 |
('filetree', treeview.FileTreeView), |
7992
4ff9f25cb06e
[table views] closes #1986413: refactor TableView, EntityAttributesTableView, PyValTableView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7845
diff
changeset
|
206 |
('jsonexport', json.JsonRsetView), |
0 | 207 |
('list', baseviews.ListView), |
208 |
('oneline', baseviews.OneLineView), |
|
587
c8ff5d88f164
adding views to test
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents:
479
diff
changeset
|
209 |
('owlabox', owl.OWLABOXView), |
7017
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
210 |
('primary', primary.PrimaryView),] + RDFVIEWS + [ |
1654 | 211 |
('rsetxml', xmlrss.XMLRsetView), |
212 |
('rss', xmlrss.RSSView), |
|
0 | 213 |
('security', management.SecurityManagementView), |
7992
4ff9f25cb06e
[table views] closes #1986413: refactor TableView, EntityAttributesTableView, PyValTableView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7845
diff
changeset
|
214 |
('table', tableview.RsetTableView), |
0 | 215 |
('text', baseviews.TextView), |
444 | 216 |
('treeview', treeview.TreeView), |
0 | 217 |
('xbel', xbel.XbelView), |
1654 | 218 |
('xml', xmlrss.XMLView), |
0 | 219 |
]) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
220 |
|
793 | 221 |
def test_possible_views_any_rset(self): |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
222 |
req = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
223 |
rset = req.execute('Any N, X WHERE X in_group Y, Y name N') |
0 | 224 |
self.assertListEqual(self.pviews(req, rset), |
1654 | 225 |
[('csvexport', csvexport.CSVRsetView), |
7992
4ff9f25cb06e
[table views] closes #1986413: refactor TableView, EntityAttributesTableView, PyValTableView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7845
diff
changeset
|
226 |
('jsonexport', json.JsonRsetView), |
1654 | 227 |
('rsetxml', xmlrss.XMLRsetView), |
7992
4ff9f25cb06e
[table views] closes #1986413: refactor TableView, EntityAttributesTableView, PyValTableView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7845
diff
changeset
|
228 |
('table', tableview.RsetTableView), |
0 | 229 |
]) |
793 | 230 |
|
231 |
def test_possible_views_multiple_eusers(self): |
|
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
232 |
req = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
233 |
rset = req.execute('CWUser X') |
0 | 234 |
self.assertListEqual(self.pviews(req, rset), |
4494
ccb7fce7297b
AdaptedList -> SameETypeList
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4493
diff
changeset
|
235 |
[('csvexport', csvexport.CSVRsetView), |
1654 | 236 |
('ecsvexport', csvexport.CSVEntityView), |
7992
4ff9f25cb06e
[table views] closes #1986413: refactor TableView, EntityAttributesTableView, PyValTableView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7845
diff
changeset
|
237 |
('ejsonexport', json.JsonEntityView), |
444 | 238 |
('filetree', treeview.FileTreeView), |
1654 | 239 |
('foaf', cwuser.FoafView), |
7992
4ff9f25cb06e
[table views] closes #1986413: refactor TableView, EntityAttributesTableView, PyValTableView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7845
diff
changeset
|
240 |
('jsonexport', json.JsonRsetView), |
0 | 241 |
('list', baseviews.ListView), |
242 |
('oneline', baseviews.OneLineView), |
|
587
c8ff5d88f164
adding views to test
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents:
479
diff
changeset
|
243 |
('owlabox', owl.OWLABOXView), |
7017
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
244 |
('primary', primary.PrimaryView)] + RDFVIEWS + [ |
1654 | 245 |
('rsetxml', xmlrss.XMLRsetView), |
246 |
('rss', xmlrss.RSSView), |
|
4494
ccb7fce7297b
AdaptedList -> SameETypeList
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4493
diff
changeset
|
247 |
('sameetypelist', baseviews.SameETypeListView), |
0 | 248 |
('security', management.SecurityManagementView), |
7992
4ff9f25cb06e
[table views] closes #1986413: refactor TableView, EntityAttributesTableView, PyValTableView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7845
diff
changeset
|
249 |
('table', tableview.RsetTableView), |
0 | 250 |
('text', baseviews.TextView), |
444 | 251 |
('treeview', treeview.TreeView), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
793
diff
changeset
|
252 |
('vcard', vcard.VCardCWUserView), |
0 | 253 |
('xbel', xbel.XbelView), |
1654 | 254 |
('xml', xmlrss.XMLView), |
0 | 255 |
]) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
256 |
|
0 | 257 |
def test_possible_actions_none_rset(self): |
258 |
req = self.request() |
|
3468
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
259 |
self.assertDictEqual(self.pactionsdict(req, None, skipcategories=()), |
0 | 260 |
{'useractions': USERACTIONS, |
261 |
'siteactions': SITEACTIONS, |
|
7017
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
262 |
'manage': MANAGEACTIONS, |
3587 | 263 |
'footer': FOOTERACTIONS, |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
264 |
|
0 | 265 |
}) |
266 |
def test_possible_actions_no_entity(self): |
|
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
267 |
req = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
268 |
rset = req.execute('Any X WHERE X eid 999999') |
3468
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
269 |
self.assertDictEqual(self.pactionsdict(req, rset, skipcategories=()), |
0 | 270 |
{'useractions': USERACTIONS, |
271 |
'siteactions': SITEACTIONS, |
|
7017
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
272 |
'manage': MANAGEACTIONS, |
3587 | 273 |
'footer': FOOTERACTIONS, |
0 | 274 |
}) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
275 |
|
0 | 276 |
def test_possible_actions_same_type_entities(self): |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
277 |
req = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
278 |
rset = req.execute('CWGroup X') |
3468
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
279 |
self.assertDictEqual(self.pactionsdict(req, rset, skipcategories=()), |
0 | 280 |
{'useractions': USERACTIONS, |
281 |
'siteactions': SITEACTIONS, |
|
7017
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
282 |
'manage': MANAGEACTIONS, |
3587 | 283 |
'footer': FOOTERACTIONS, |
3468
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
284 |
'mainactions': [actions.MultipleEditAction], |
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
285 |
'moreactions': [actions.DeleteAction, |
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
286 |
actions.AddNewAction], |
0 | 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_different_types_entities(self): |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
290 |
req = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
291 |
rset = req.execute('Any X') |
3468
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
292 |
self.assertDictEqual(self.pactionsdict(req, rset, skipcategories=()), |
0 | 293 |
{'useractions': USERACTIONS, |
294 |
'siteactions': SITEACTIONS, |
|
7017
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
295 |
'manage': MANAGEACTIONS, |
3587 | 296 |
'footer': FOOTERACTIONS, |
3468
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
297 |
'moreactions': [actions.DeleteAction], |
0 | 298 |
}) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
299 |
|
0 | 300 |
def test_possible_actions_final_entities(self): |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
301 |
req = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
302 |
rset = req.execute('Any N, X WHERE X in_group Y, Y name N') |
3468
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
303 |
self.assertDictEqual(self.pactionsdict(req, rset, skipcategories=()), |
0 | 304 |
{'useractions': USERACTIONS, |
3587 | 305 |
'siteactions': SITEACTIONS, |
7017
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
306 |
'manage': MANAGEACTIONS, |
3587 | 307 |
'footer': FOOTERACTIONS, |
308 |
}) |
|
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
309 |
|
1654 | 310 |
def test_possible_actions_eetype_cwuser_entity(self): |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
311 |
req = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
312 |
rset = req.execute('CWEType X WHERE X name "CWUser"') |
3468
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
313 |
self.assertDictEqual(self.pactionsdict(req, rset, skipcategories=()), |
0 | 314 |
{'useractions': USERACTIONS, |
315 |
'siteactions': SITEACTIONS, |
|
7017
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
316 |
'manage': MANAGEACTIONS, |
3587 | 317 |
'footer': FOOTERACTIONS, |
4492
150f1d57ecfd
fix test broken by introduction of ViewSameEType action
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4491
diff
changeset
|
318 |
'mainactions': [actions.ModifyAction, |
150f1d57ecfd
fix test broken by introduction of ViewSameEType action
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4491
diff
changeset
|
319 |
actions.ViewSameCWEType], |
3468
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
320 |
'moreactions': [actions.ManagePermissionsAction, |
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
321 |
actions.AddRelatedActions, |
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
322 |
actions.DeleteAction, |
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
323 |
actions.CopyAction, |
1654 | 324 |
], |
0 | 325 |
}) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
326 |
|
0 | 327 |
|
328 |
def test_select_creation_form(self): |
|
329 |
rset = None |
|
330 |
req = self.request() |
|
331 |
# creation form |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
793
diff
changeset
|
332 |
req.form['etype'] = 'CWGroup' |
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
|
333 |
self.assertIsInstance(self.vreg['views'].select('creation', req, rset=rset), |
1654 | 334 |
editforms.CreationFormView) |
0 | 335 |
del req.form['etype'] |
336 |
# custom creation form |
|
1654 | 337 |
class CWUserCreationForm(editforms.CreationFormView): |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
793
diff
changeset
|
338 |
__select__ = specified_etype_implements('CWUser') |
1654 | 339 |
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
|
340 |
self.vreg.register(CWUserCreationForm) |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
793
diff
changeset
|
341 |
req.form['etype'] = 'CWUser' |
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
|
342 |
self.assertIsInstance(self.vreg['views'].select('creation', req, rset=rset), |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
793
diff
changeset
|
343 |
CWUserCreationForm) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
344 |
|
0 | 345 |
def test_select_view(self): |
346 |
# no entity |
|
347 |
rset = None |
|
348 |
req = self.request() |
|
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
|
349 |
self.assertIsInstance(self.vreg['views'].select('index', req, rset=rset), |
0 | 350 |
startup.IndexView) |
7792
163d25c9fdd2
[test] fix bad sed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7791
diff
changeset
|
351 |
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
|
352 |
self.vreg['views'].select, 'primary', req, rset=rset) |
7792
163d25c9fdd2
[test] fix bad sed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7791
diff
changeset
|
353 |
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
|
354 |
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
|
355 |
|
0 | 356 |
# no entity |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
357 |
req = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
358 |
rset = req.execute('Any X WHERE X eid 999999') |
7792
163d25c9fdd2
[test] fix bad sed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7791
diff
changeset
|
359 |
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
|
360 |
self.vreg['views'].select, 'index', req, rset=rset) |
7792
163d25c9fdd2
[test] fix bad sed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7791
diff
changeset
|
361 |
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
|
362 |
self.vreg['views'].select, 'creation', req, rset=rset) |
7792
163d25c9fdd2
[test] fix bad sed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7791
diff
changeset
|
363 |
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
|
364 |
self.vreg['views'].select, 'primary', req, rset=rset) |
7792
163d25c9fdd2
[test] fix bad sed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7791
diff
changeset
|
365 |
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
|
366 |
self.vreg['views'].select, 'table', req, rset=rset) |
0 | 367 |
# one entity |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
368 |
req = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
369 |
rset = req.execute('CWGroup X WHERE X name "managers"') |
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
|
370 |
self.assertIsInstance(self.vreg['views'].select('primary', req, rset=rset), |
1654 | 371 |
primary.PrimaryView) |
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
|
372 |
self.assertIsInstance(self.vreg['views'].select('list', req, rset=rset), |
0 | 373 |
baseviews.ListView) |
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
|
374 |
self.assertIsInstance(self.vreg['views'].select('edition', req, rset=rset), |
1654 | 375 |
editforms.EditionFormView) |
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
|
376 |
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
|
377 |
tableview.RsetTableView) |
7792
163d25c9fdd2
[test] fix bad sed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7791
diff
changeset
|
378 |
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
|
379 |
self.vreg['views'].select, 'creation', req, rset=rset) |
7792
163d25c9fdd2
[test] fix bad sed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7791
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, 'index', req, rset=rset) |
0 | 382 |
# list of entities of the same type |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
383 |
req = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
384 |
rset = req.execute('CWGroup X') |
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
|
385 |
self.assertIsInstance(self.vreg['views'].select('primary', req, rset=rset), |
1654 | 386 |
primary.PrimaryView) |
2650
18aec79ec3a3
R [vreg] important refactoring of the vregistry, moving behaviour to end dictionnary (and so leaving room for more flexibility ; keep bw compat ; update api usage in cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2643
diff
changeset
|
387 |
self.assertIsInstance(self.vreg['views'].select('list', req, rset=rset), |
0 | 388 |
baseviews.ListView) |
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
|
389 |
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
|
390 |
tableview.RsetTableView) |
7792
163d25c9fdd2
[test] fix bad sed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7791
diff
changeset
|
391 |
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
|
392 |
self.vreg['views'].select, 'creation', req, rset=rset) |
0 | 393 |
# list of entities of different types |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
394 |
req = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
395 |
rset = req.execute('Any X') |
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
|
396 |
self.assertIsInstance(self.vreg['views'].select('primary', req, rset=rset), |
1654 | 397 |
primary.PrimaryView) |
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
|
398 |
self.assertIsInstance(self.vreg['views'].select('list', req, rset=rset), |
0 | 399 |
baseviews.ListView) |
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
|
400 |
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
|
401 |
tableview.RsetTableView) |
7792
163d25c9fdd2
[test] fix bad sed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7791
diff
changeset
|
402 |
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
|
403 |
self.vreg['views'].select, 'creation', req, rset=rset) |
7792
163d25c9fdd2
[test] fix bad sed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7791
diff
changeset
|
404 |
self.assertRaises(NoSelectableObject, |
2650
18aec79ec3a3
R [vreg] important refactoring of the vregistry, moving behaviour to end dictionnary (and so leaving room for more flexibility ; keep bw compat ; update api usage in cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2643
diff
changeset
|
405 |
self.vreg['views'].select, 'index', req, rset=rset) |
0 | 406 |
# whatever |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
407 |
req = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
408 |
rset = req.execute('Any N, X WHERE X in_group Y, Y name N') |
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
|
409 |
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
|
410 |
tableview.RsetTableView) |
7792
163d25c9fdd2
[test] fix bad sed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7791
diff
changeset
|
411 |
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
|
412 |
self.vreg['views'].select, 'index', req, rset=rset) |
7792
163d25c9fdd2
[test] fix bad sed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7791
diff
changeset
|
413 |
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
|
414 |
self.vreg['views'].select, 'creation', req, rset=rset) |
7792
163d25c9fdd2
[test] fix bad sed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7791
diff
changeset
|
415 |
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
|
416 |
self.vreg['views'].select, 'primary', req, rset=rset) |
7792
163d25c9fdd2
[test] fix bad sed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7791
diff
changeset
|
417 |
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
|
418 |
self.vreg['views'].select, 'list', req, rset=rset) |
7792
163d25c9fdd2
[test] fix bad sed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7791
diff
changeset
|
419 |
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
|
420 |
self.vreg['views'].select, 'edition', req, rset=rset) |
0 | 421 |
# mixed query |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
422 |
req = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
423 |
rset = req.execute('Any U,G WHERE U is CWUser, G is CWGroup') |
7792
163d25c9fdd2
[test] fix bad sed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7791
diff
changeset
|
424 |
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
|
425 |
self.vreg['views'].select, 'edition', req, rset=rset) |
7792
163d25c9fdd2
[test] fix bad sed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7791
diff
changeset
|
426 |
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
|
427 |
self.vreg['views'].select, 'creation', req, rset=rset) |
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
|
428 |
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
|
429 |
tableview.RsetTableView) |
0 | 430 |
|
431 |
def test_interface_selector(self): |
|
5570
50b887d25233
[test] no more Image type w/ cw 3.9
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5426
diff
changeset
|
432 |
image = self.request().create_entity('File', data_name=u'bim.png', data=Binary('bim')) |
0 | 433 |
# image primary view priority |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
434 |
req = self.request() |
5570
50b887d25233
[test] no more Image type w/ cw 3.9
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5426
diff
changeset
|
435 |
rset = req.execute('File X WHERE X data_name "bim.png"') |
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
|
436 |
self.assertIsInstance(self.vreg['views'].select('primary', req, rset=rset), |
0 | 437 |
idownloadable.IDownloadablePrimaryView) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
438 |
|
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
439 |
|
0 | 440 |
def test_score_entity_selector(self): |
5570
50b887d25233
[test] no more Image type w/ cw 3.9
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5426
diff
changeset
|
441 |
image = self.request().create_entity('File', data_name=u'bim.png', data=Binary('bim')) |
6048
4695b1ee58a0
fix idownload view pb. for xhtml browsers
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6031
diff
changeset
|
442 |
# image/ehtml primary view priority |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
443 |
req = self.request() |
5570
50b887d25233
[test] no more Image type w/ cw 3.9
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5426
diff
changeset
|
444 |
rset = req.execute('File X WHERE X data_name "bim.png"') |
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
|
445 |
self.assertIsInstance(self.vreg['views'].select('image', req, rset=rset), |
0 | 446 |
idownloadable.ImageView) |
6048
4695b1ee58a0
fix idownload view pb. for xhtml browsers
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6031
diff
changeset
|
447 |
self.assertRaises(NoSelectableObject, self.vreg['views'].select, 'ehtml', req, rset=rset) |
4695b1ee58a0
fix idownload view pb. for xhtml browsers
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6031
diff
changeset
|
448 |
|
4695b1ee58a0
fix idownload view pb. for xhtml browsers
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6031
diff
changeset
|
449 |
fileobj = self.request().create_entity('File', data_name=u'bim.html', data=Binary('<html>bam</html')) |
4695b1ee58a0
fix idownload view pb. for xhtml browsers
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6031
diff
changeset
|
450 |
# image/ehtml primary view priority |
4695b1ee58a0
fix idownload view pb. for xhtml browsers
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6031
diff
changeset
|
451 |
req = self.request() |
4695b1ee58a0
fix idownload view pb. for xhtml browsers
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6031
diff
changeset
|
452 |
rset = req.execute('File X WHERE X data_name "bim.html"') |
4695b1ee58a0
fix idownload view pb. for xhtml browsers
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6031
diff
changeset
|
453 |
self.assertIsInstance(self.vreg['views'].select('ehtml', req, rset=rset), |
4695b1ee58a0
fix idownload view pb. for xhtml browsers
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6031
diff
changeset
|
454 |
idownloadable.EHTMLView) |
4695b1ee58a0
fix idownload view pb. for xhtml browsers
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6031
diff
changeset
|
455 |
self.assertRaises(NoSelectableObject, self.vreg['views'].select, 'image', req, rset=rset) |
4695b1ee58a0
fix idownload view pb. for xhtml browsers
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6031
diff
changeset
|
456 |
|
4695b1ee58a0
fix idownload view pb. for xhtml browsers
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6031
diff
changeset
|
457 |
fileobj = self.request().create_entity('File', data_name=u'bim.txt', data=Binary('boum')) |
4695b1ee58a0
fix idownload view pb. for xhtml browsers
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6031
diff
changeset
|
458 |
# image/ehtml primary view priority |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
459 |
req = self.request() |
3589 | 460 |
rset = req.execute('File X WHERE X data_name "bim.txt"') |
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
|
461 |
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
|
462 |
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
|
463 |
|
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
464 |
|
0 | 465 |
def _test_view(self, vid, rql, args): |
466 |
if rql is None: |
|
467 |
rset = None |
|
468 |
req = self.request() |
|
469 |
else: |
|
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
470 |
req = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
471 |
rset = req.execute(rql) |
0 | 472 |
try: |
4182 | 473 |
obj = self.vreg['views'].select(vid, req, rset=rset, **args) |
4172
4d4cef034eec
all web tests OK
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4078
diff
changeset
|
474 |
return obj.render(**args) |
7815
2a164a9cf81c
[exceptions] stop catching any exception in various places (closes #1942716)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7244
diff
changeset
|
475 |
except Exception: |
0 | 476 |
print vid, rset, args |
477 |
raise |
|
478 |
||
479 |
def test_form(self): |
|
480 |
for vid, rql, args in ( |
|
481 |
#('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
|
482 |
('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
|
483 |
('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
|
484 |
('muledit', 'CWGroup X', {}), |
0 | 485 |
#('muledit', 'Any X', {}), |
486 |
): |
|
487 |
self._test_view(vid, rql, args) |
|
488 |
||
489 |
||
490 |
def test_properties(self): |
|
6367
d4c485ec1ca1
fix merge, some buffers weren't saved...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
491 |
self.assertEqual(sorted(k for k in self.vreg['propertydefs'].keys() |
6141
b8287e54b528
[web api] unify 'contentnav' (VComponent) and 'boxes' registries as 'ctxcomponents' (CtxComponent)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6048
diff
changeset
|
492 |
if k.startswith('ctxcomponents.edit_box')), |
b8287e54b528
[web api] unify 'contentnav' (VComponent) and 'boxes' registries as 'ctxcomponents' (CtxComponent)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6048
diff
changeset
|
493 |
['ctxcomponents.edit_box.context', |
b8287e54b528
[web api] unify 'contentnav' (VComponent) and 'boxes' registries as 'ctxcomponents' (CtxComponent)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6048
diff
changeset
|
494 |
'ctxcomponents.edit_box.order', |
b8287e54b528
[web api] unify 'contentnav' (VComponent) and 'boxes' registries as 'ctxcomponents' (CtxComponent)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6048
diff
changeset
|
495 |
'ctxcomponents.edit_box.visible']) |
6340
470d8e828fda
[test] update test to unittest2 api (still using lgc.testlib though)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6048
diff
changeset
|
496 |
self.assertEqual([k for k in self.vreg['propertyvalues'].keys() |
0 | 497 |
if not k.startswith('system.version')], |
498 |
[]) |
|
6367
d4c485ec1ca1
fix merge, some buffers weren't saved...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6366
diff
changeset
|
499 |
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
|
500 |
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
|
501 |
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
|
502 |
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
|
503 |
self.assertRaises(UnknownProperty, self.vreg.property_value, 'ctxcomponents.actions_box') |
0 | 504 |
|
505 |
||
506 |
||
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
793
diff
changeset
|
507 |
class CWETypeRQLAction(Action): |
3408
c92170fca813
[api] use __regid__ instead of deprecated id
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3230
diff
changeset
|
508 |
__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
|
509 |
__select__ = is_instance('CWEType') & rql_condition('X name "CWEType"') |
0 | 510 |
title = 'bla' |
511 |
||
512 |
class RQLActionTC(ViewSelectorTC): |
|
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
513 |
|
0 | 514 |
def setUp(self): |
515 |
super(RQLActionTC, self).setUp() |
|
1654 | 516 |
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
|
517 |
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
|
518 |
actionsreg = self.vreg['actions'] |
4534 | 519 |
actionsreg['testaction'][0].__registered__(actionsreg) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
520 |
|
0 | 521 |
def tearDown(self): |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
522 |
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
|
523 |
del self.vreg['actions']['testaction'] |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
524 |
|
0 | 525 |
def test(self): |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
526 |
req = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
527 |
rset = req.execute('CWEType X WHERE X name "CWEType"') |
3468
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
528 |
self.assertDictEqual(self.pactionsdict(req, rset, skipcategories=()), |
0 | 529 |
{'useractions': USERACTIONS, |
530 |
'siteactions': SITEACTIONS, |
|
3587 | 531 |
'footer': FOOTERACTIONS, |
7017
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
532 |
'manage': MANAGEACTIONS, |
4492
150f1d57ecfd
fix test broken by introduction of ViewSameEType action
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4491
diff
changeset
|
533 |
'mainactions': [actions.ModifyAction, actions.ViewSameCWEType], |
3468
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
534 |
'moreactions': [actions.ManagePermissionsAction, |
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
535 |
actions.AddRelatedActions, |
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
536 |
actions.DeleteAction, |
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
537 |
actions.CopyAction, |
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
538 |
CWETypeRQLAction, |
1654 | 539 |
], |
0 | 540 |
}) |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
541 |
req = self.request() |
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3408
diff
changeset
|
542 |
rset = req.execute('CWEType X WHERE X name "CWRType"') |
3468
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
543 |
self.assertDictEqual(self.pactionsdict(req, rset, skipcategories=()), |
0 | 544 |
{'useractions': USERACTIONS, |
545 |
'siteactions': SITEACTIONS, |
|
3587 | 546 |
'footer': FOOTERACTIONS, |
7017
cd2ea273007a
[web test] fix some tests broken by recent (and various) changesets
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6367
diff
changeset
|
547 |
'manage': MANAGEACTIONS, |
4492
150f1d57ecfd
fix test broken by introduction of ViewSameEType action
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4491
diff
changeset
|
548 |
'mainactions': [actions.ModifyAction, actions.ViewSameCWEType], |
3468
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
549 |
'moreactions': [actions.ManagePermissionsAction, |
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
550 |
actions.AddRelatedActions, |
b02fa4db2868
[tests] make unittest_viewselectors pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
551 |
actions.DeleteAction, |
3735 | 552 |
actions.CopyAction,] |
0 | 553 |
}) |
1570
5c40d9fb4e8d
stop using card in test, update form tests
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
554 |
|
0 | 555 |
|
556 |
||
557 |
if __name__ == '__main__': |
|
558 |
unittest_main() |