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