ims.fieldupdater 3.0.0rc2__py3-none-any.whl → 3.0.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ims/fieldupdater/__init__.py +4 -2
- ims/fieldupdater/browser/__init__.py +1 -1
- ims/fieldupdater/browser/configure.zcml +15 -15
- ims/fieldupdater/browser/mass.pt +365 -265
- ims/fieldupdater/browser/mass.py +369 -370
- ims/fieldupdater/browser/schema.pt +66 -66
- ims/fieldupdater/configure.zcml +20 -20
- ims/fieldupdater/profiles/default/controlpanel.xml +10 -10
- ims/fieldupdater/profiles/default/metadata.xml +3 -3
- ims/fieldupdater/profiles/uninstall/controlpanel.xml +4 -4
- ims/fieldupdater/testing.py +53 -39
- {ims.fieldupdater-3.0.0rc2.dist-info → ims_fieldupdater-3.0.3.dist-info}/METADATA +20 -18
- ims_fieldupdater-3.0.3.dist-info/RECORD +15 -0
- {ims.fieldupdater-3.0.0rc2.dist-info → ims_fieldupdater-3.0.3.dist-info}/WHEEL +1 -2
- ims/__init__.py +0 -1
- ims/fieldupdater/tests/__init__.py +0 -1
- ims/fieldupdater/tests/base.py +0 -55
- ims/fieldupdater/tests/interfaces.py +0 -38
- ims/fieldupdater/tests/test_mass.py +0 -145
- ims/fieldupdater/tests/test_uninstall.py +0 -23
- ims.fieldupdater-3.0.0rc2.dist-info/RECORD +0 -22
- ims.fieldupdater-3.0.0rc2.dist-info/top_level.txt +0 -1
- {ims.fieldupdater-3.0.0rc2.dist-info → ims_fieldupdater-3.0.3.dist-info}/entry_points.txt +0 -0
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"
|
|
2
|
-
lang="en-US"
|
|
3
|
-
metal:use-macro="context/prefs_main_template/macros/master"
|
|
4
|
-
i18n:domain="ims.fieldupdater">
|
|
5
|
-
|
|
6
|
-
<tal:block metal:fill-slot="top_slot">
|
|
7
|
-
<tal:block tal:define="dummy python:request.set('disable_border',1)"/>
|
|
8
|
-
</tal:block>
|
|
9
|
-
|
|
10
|
-
<body>
|
|
11
|
-
<div metal:fill-slot="prefs_configlet_main"
|
|
12
|
-
tal:define="errors python:request.get('errors', {});
|
|
13
|
-
content_type python:request.get('content_type', '');">
|
|
14
|
-
|
|
15
|
-
<h1 i18n:translate="heading_schema_field_manager">Schema Finder</h1>
|
|
16
|
-
|
|
17
|
-
<tal:content_types tal:define="types view/get_types;">
|
|
18
|
-
<form action="${context/absolute_url}/schema-finder" method="get">
|
|
19
|
-
<fieldset>
|
|
20
|
-
<legend>
|
|
21
|
-
Choose a Content Type
|
|
22
|
-
</legend>
|
|
23
|
-
|
|
24
|
-
<div class="field">
|
|
25
|
-
<label for="schemafield" i18n:translate="label_schema_field">
|
|
26
|
-
Content Type
|
|
27
|
-
</label>
|
|
28
|
-
|
|
29
|
-
<select name="content_type" id="content_type"
|
|
30
|
-
onchange="javascript:this.form.submit()">
|
|
31
|
-
<option tal:repeat="type types"
|
|
32
|
-
value="${type}"
|
|
33
|
-
selected="${python:type==content_type}"
|
|
34
|
-
i18n:translate=""
|
|
35
|
-
i18n:domain="plone">
|
|
36
|
-
${type}
|
|
37
|
-
</option>
|
|
38
|
-
</select>
|
|
39
|
-
</div>
|
|
40
|
-
</fieldset>
|
|
41
|
-
</form>
|
|
42
|
-
</tal:content_types>
|
|
43
|
-
|
|
44
|
-
<tal:schemas tal:condition="content_type" >
|
|
45
|
-
<fieldset id="fieldset-schema">
|
|
46
|
-
<legend>
|
|
47
|
-
Choose Schema
|
|
48
|
-
</legend>
|
|
49
|
-
<p>
|
|
50
|
-
In most cases you will want the base schema which is listed first. Following that are the behaviors
|
|
51
|
-
available for this content type.
|
|
52
|
-
</p>
|
|
53
|
-
<ul>
|
|
54
|
-
<tal:schema repeat="schema view/schemas">
|
|
55
|
-
<li>
|
|
56
|
-
<a href="${context/absolute_url}/mass-edit?schema=${schema/id}">
|
|
57
|
-
${schema/title}
|
|
58
|
-
</a>
|
|
59
|
-
</li>
|
|
60
|
-
</tal:schema>
|
|
61
|
-
</ul>
|
|
62
|
-
</fieldset>
|
|
63
|
-
</tal:schemas>
|
|
64
|
-
</div>
|
|
65
|
-
</body>
|
|
66
|
-
</html>
|
|
1
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"
|
|
2
|
+
lang="en-US"
|
|
3
|
+
metal:use-macro="context/prefs_main_template/macros/master"
|
|
4
|
+
i18n:domain="ims.fieldupdater">
|
|
5
|
+
|
|
6
|
+
<tal:block metal:fill-slot="top_slot">
|
|
7
|
+
<tal:block tal:define="dummy python:request.set('disable_border',1)"/>
|
|
8
|
+
</tal:block>
|
|
9
|
+
|
|
10
|
+
<body>
|
|
11
|
+
<div metal:fill-slot="prefs_configlet_main"
|
|
12
|
+
tal:define="errors python:request.get('errors', {});
|
|
13
|
+
content_type python:request.get('content_type', '');">
|
|
14
|
+
|
|
15
|
+
<h1 i18n:translate="heading_schema_field_manager">Schema Finder</h1>
|
|
16
|
+
|
|
17
|
+
<tal:content_types tal:define="types view/get_types;">
|
|
18
|
+
<form action="${context/absolute_url}/schema-finder" method="get">
|
|
19
|
+
<fieldset>
|
|
20
|
+
<legend>
|
|
21
|
+
Choose a Content Type
|
|
22
|
+
</legend>
|
|
23
|
+
|
|
24
|
+
<div class="field">
|
|
25
|
+
<label for="schemafield" i18n:translate="label_schema_field">
|
|
26
|
+
Content Type
|
|
27
|
+
</label>
|
|
28
|
+
|
|
29
|
+
<select name="content_type" id="content_type"
|
|
30
|
+
onchange="javascript:this.form.submit()">
|
|
31
|
+
<option tal:repeat="type types"
|
|
32
|
+
value="${type}"
|
|
33
|
+
selected="${python:type==content_type}"
|
|
34
|
+
i18n:translate=""
|
|
35
|
+
i18n:domain="plone">
|
|
36
|
+
${type}
|
|
37
|
+
</option>
|
|
38
|
+
</select>
|
|
39
|
+
</div>
|
|
40
|
+
</fieldset>
|
|
41
|
+
</form>
|
|
42
|
+
</tal:content_types>
|
|
43
|
+
|
|
44
|
+
<tal:schemas tal:condition="content_type" >
|
|
45
|
+
<fieldset id="fieldset-schema">
|
|
46
|
+
<legend>
|
|
47
|
+
Choose Schema
|
|
48
|
+
</legend>
|
|
49
|
+
<p>
|
|
50
|
+
In most cases you will want the base schema which is listed first. Following that are the behaviors
|
|
51
|
+
available for this content type.
|
|
52
|
+
</p>
|
|
53
|
+
<ul>
|
|
54
|
+
<tal:schema repeat="schema view/schemas">
|
|
55
|
+
<li>
|
|
56
|
+
<a href="${context/absolute_url}/mass-edit?schema=${schema/id}">
|
|
57
|
+
${schema/title}
|
|
58
|
+
</a>
|
|
59
|
+
</li>
|
|
60
|
+
</tal:schema>
|
|
61
|
+
</ul>
|
|
62
|
+
</fieldset>
|
|
63
|
+
</tal:schemas>
|
|
64
|
+
</div>
|
|
65
|
+
</body>
|
|
66
|
+
</html>
|
ims/fieldupdater/configure.zcml
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
<configure
|
|
2
|
-
xmlns="http://namespaces.zope.org/zope"
|
|
3
|
-
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
|
|
4
|
-
i18n_domain="ims.fieldupdater">
|
|
5
|
-
|
|
6
|
-
<include package=".browser"/>
|
|
7
|
-
|
|
8
|
-
<genericsetup:registerProfile
|
|
9
|
-
name="default"
|
|
10
|
-
title="ims.fieldupdater"
|
|
11
|
-
directory="profiles/default"
|
|
12
|
-
description="Adds control panel configlet for this tool"
|
|
13
|
-
provides="Products.GenericSetup.interfaces.EXTENSION"/>
|
|
14
|
-
|
|
15
|
-
<genericsetup:registerProfile
|
|
16
|
-
name="uninstall"
|
|
17
|
-
title="ims.fieldupdater [uninstall]"
|
|
18
|
-
directory="profiles/uninstall"
|
|
19
|
-
provides="Products.GenericSetup.interfaces.EXTENSION"/>
|
|
20
|
-
|
|
1
|
+
<configure
|
|
2
|
+
xmlns="http://namespaces.zope.org/zope"
|
|
3
|
+
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
|
|
4
|
+
i18n_domain="ims.fieldupdater">
|
|
5
|
+
|
|
6
|
+
<include package=".browser"/>
|
|
7
|
+
|
|
8
|
+
<genericsetup:registerProfile
|
|
9
|
+
name="default"
|
|
10
|
+
title="ims.fieldupdater"
|
|
11
|
+
directory="profiles/default"
|
|
12
|
+
description="Adds control panel configlet for this tool"
|
|
13
|
+
provides="Products.GenericSetup.interfaces.EXTENSION"/>
|
|
14
|
+
|
|
15
|
+
<genericsetup:registerProfile
|
|
16
|
+
name="uninstall"
|
|
17
|
+
title="ims.fieldupdater [uninstall]"
|
|
18
|
+
directory="profiles/uninstall"
|
|
19
|
+
provides="Products.GenericSetup.interfaces.EXTENSION"/>
|
|
20
|
+
|
|
21
21
|
</configure>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
<?xml version="1.0"?>
|
|
2
|
-
<object name="portal_controlpanel" meta_type="Plone Control Panel Tool"
|
|
3
|
-
xmlns:i18n="http://xml.zope.org/namespaces/i18n" i18n:domain="plone">
|
|
4
|
-
<configlet title="Mass Edits" action_id="FieldUpdater"
|
|
5
|
-
appId="ims.fieldupdater" category="Products" condition_expr=""
|
|
6
|
-
icon_expr="string:pencil-square"
|
|
7
|
-
url_expr="string:${portal_url}/@@mass-edit"
|
|
8
|
-
visible="True" i18n:attributes="title">
|
|
9
|
-
<permission>Manage portal</permission>
|
|
10
|
-
</configlet>
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<object name="portal_controlpanel" meta_type="Plone Control Panel Tool"
|
|
3
|
+
xmlns:i18n="http://xml.zope.org/namespaces/i18n" i18n:domain="plone">
|
|
4
|
+
<configlet title="Mass Edits" action_id="FieldUpdater"
|
|
5
|
+
appId="ims.fieldupdater" category="Products" condition_expr=""
|
|
6
|
+
icon_expr="string:pencil-square"
|
|
7
|
+
url_expr="string:${portal_url}/@@mass-edit"
|
|
8
|
+
visible="True" i18n:attributes="title">
|
|
9
|
+
<permission>Manage portal</permission>
|
|
10
|
+
</configlet>
|
|
11
11
|
</object>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<?xml version="1.0"?>
|
|
2
|
-
<metadata>
|
|
3
|
-
<version>1</version>
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<metadata>
|
|
3
|
+
<version>1</version>
|
|
4
4
|
</metadata>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<?xml version="1.0"?>
|
|
2
|
-
<object name="portal_controlpanel" meta_type="Plone Control Panel Tool"
|
|
3
|
-
xmlns:i18n="http://xml.zope.org/namespaces/i18n" i18n:domain="plone">
|
|
4
|
-
<configlet action_id="FieldUpdater" remove="true"/>
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<object name="portal_controlpanel" meta_type="Plone Control Panel Tool"
|
|
3
|
+
xmlns:i18n="http://xml.zope.org/namespaces/i18n" i18n:domain="plone">
|
|
4
|
+
<configlet action_id="FieldUpdater" remove="true"/>
|
|
5
5
|
</object>
|
ims/fieldupdater/testing.py
CHANGED
|
@@ -1,39 +1,53 @@
|
|
|
1
|
-
import
|
|
2
|
-
from plone.app.
|
|
3
|
-
from plone.app.testing import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
applyProfile(portal,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
bases=(
|
|
33
|
-
name="
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
bases=(
|
|
38
|
-
name="
|
|
39
|
-
)
|
|
1
|
+
from plone.app.contenttypes.testing import PLONE_APP_CONTENTTYPES_FIXTURE
|
|
2
|
+
from plone.app.robotframework.testing import REMOTE_LIBRARY_BUNDLE_FIXTURE
|
|
3
|
+
from plone.app.testing import FunctionalTesting
|
|
4
|
+
from plone.app.testing import IntegrationTesting
|
|
5
|
+
from plone.app.testing import PloneSandboxLayer
|
|
6
|
+
from plone.app.testing import applyProfile
|
|
7
|
+
from plone.protect import auto
|
|
8
|
+
from plone.testing.zope import WSGI_SERVER_FIXTURE
|
|
9
|
+
|
|
10
|
+
import ims.fieldupdater
|
|
11
|
+
|
|
12
|
+
ORIGINAL_CSRF_DISABLED = auto.CSRF_DISABLED
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class FieldUpdaterLayer(PloneSandboxLayer):
|
|
16
|
+
defaultBases = (PLONE_APP_CONTENTTYPES_FIXTURE,)
|
|
17
|
+
|
|
18
|
+
def setUpZope(self, app, configurationContext):
|
|
19
|
+
auto.CSRF_DISABLED = True
|
|
20
|
+
self.loadZCML(package=ims.fieldupdater)
|
|
21
|
+
|
|
22
|
+
def tearDownZope(self, app):
|
|
23
|
+
auto.CSRF_DISABLED = ORIGINAL_CSRF_DISABLED
|
|
24
|
+
|
|
25
|
+
def setUpPloneSite(self, portal):
|
|
26
|
+
applyProfile(portal, "ims.fieldupdater:default")
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
FIXTURE = FieldUpdaterLayer()
|
|
30
|
+
|
|
31
|
+
INTEGRATION_TESTING = IntegrationTesting(
|
|
32
|
+
bases=(FIXTURE,),
|
|
33
|
+
name="FieldUpdaterLayer:IntegrationTesting",
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
FUNCTIONAL_TESTING = FunctionalTesting(
|
|
37
|
+
bases=(FIXTURE, WSGI_SERVER_FIXTURE),
|
|
38
|
+
name="FieldUpdaterLayer:FunctionalTesting",
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
RESTAPI_TESTING = FunctionalTesting(
|
|
42
|
+
bases=(FIXTURE, WSGI_SERVER_FIXTURE),
|
|
43
|
+
name="FieldUpdaterLayer:RestAPITesting",
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
ACCEPTANCE_TESTING = FunctionalTesting(
|
|
47
|
+
bases=(
|
|
48
|
+
FIXTURE,
|
|
49
|
+
REMOTE_LIBRARY_BUNDLE_FIXTURE,
|
|
50
|
+
WSGI_SERVER_FIXTURE,
|
|
51
|
+
),
|
|
52
|
+
name="FieldUpdaterLayer:AcceptanceTesting",
|
|
53
|
+
)
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
2
|
-
Name: ims.fieldupdater
|
|
3
|
-
Version: 3.0.
|
|
4
|
-
Summary: Update all objects in Plone based on a schema/field strategy
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Project-URL:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Classifier: Framework :: Plone :: 6.0
|
|
11
|
-
Classifier:
|
|
12
|
-
|
|
13
|
-
Requires-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Requires-Dist:
|
|
17
|
-
Requires-Dist:
|
|
18
|
-
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ims.fieldupdater
|
|
3
|
+
Version: 3.0.3
|
|
4
|
+
Summary: Update all objects in Plone based on a schema/field strategy
|
|
5
|
+
Project-URL: homepage, https://git.imsweb.com/plone/ims.fieldupdater
|
|
6
|
+
Project-URL: documentation, https://git.imsweb.com/plone/ims.fieldupdater
|
|
7
|
+
Project-URL: repository, https://git.imsweb.com/plone/ims.fieldupdater
|
|
8
|
+
Author-email: Eric Wohnlich <wohnlice@imsweb.com>
|
|
9
|
+
License: GPL
|
|
10
|
+
Classifier: Framework :: Plone :: 6.0
|
|
11
|
+
Classifier: Framework :: Plone :: 6.1
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Requires-Python: >=3.8
|
|
14
|
+
Requires-Dist: plone>=6.0.4
|
|
15
|
+
Provides-Extra: test
|
|
16
|
+
Requires-Dist: formencode; extra == 'test'
|
|
17
|
+
Requires-Dist: plone-app-robotframework; extra == 'test'
|
|
18
|
+
Requires-Dist: plone-app-testing; extra == 'test'
|
|
19
|
+
Requires-Dist: plone-mocktestcase; extra == 'test'
|
|
20
|
+
Requires-Dist: pytest-plone; extra == 'test'
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ims/fieldupdater/__init__.py,sha256=Q6545wq84hsDOa9b1vNE7q8Lur4EI253jy43Jx_5AS8,108
|
|
2
|
+
ims/fieldupdater/configure.zcml,sha256=XzjvBz_wQLJF57i-8dVOyq8hJ4hmAwN59e8u-xHo8Bw,717
|
|
3
|
+
ims/fieldupdater/testing.py,sha256=VUme-WPYsPM228xw9RNK-ZJHS_WlYokEPGcDs8ygSMk,1508
|
|
4
|
+
ims/fieldupdater/browser/__init__.py,sha256=MsSFjiLMLJZ7QhUPpVBWKiyDnCzryquRyr329NoCACI,2
|
|
5
|
+
ims/fieldupdater/browser/configure.zcml,sha256=gDg1aCneETqWVRZ7A6AZN9rBxmkhISTx_jNsxbX5AUI,500
|
|
6
|
+
ims/fieldupdater/browser/mass.pt,sha256=1KO2vqZaWM8uumPv10wWyT7KRlVoikCRDWbdZNVlXgA,11454
|
|
7
|
+
ims/fieldupdater/browser/mass.py,sha256=xzq4rkUx9gJuP9V2Ucren9BTzozPoYTbbawpd6cXTa8,15421
|
|
8
|
+
ims/fieldupdater/browser/schema.pt,sha256=e_XHK1Mi3bJd6iyZ5T33GiRL5NtZ-dxNemgFxmjhxeA,2368
|
|
9
|
+
ims/fieldupdater/profiles/default/controlpanel.xml,sha256=bQGQWeqdk1SM4WLlHQqlHJYaafUOR3tQ3RI6PTSx-rs,544
|
|
10
|
+
ims/fieldupdater/profiles/default/metadata.xml,sha256=JoYjQsedax0AZx1ToWXVw9OwYv9h7idF1JYELQGe5YE,69
|
|
11
|
+
ims/fieldupdater/profiles/uninstall/controlpanel.xml,sha256=DL402N_S8bDlu5BLneHnRwISAvuvLXvMNknOB58rJq8,237
|
|
12
|
+
ims_fieldupdater-3.0.3.dist-info/METADATA,sha256=DH1eImv54qqla_ee7loaO7tYqz80ErrgBFKJwsbxOKQ,844
|
|
13
|
+
ims_fieldupdater-3.0.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
14
|
+
ims_fieldupdater-3.0.3.dist-info/entry_points.txt,sha256=ue9oriqwbY5mDverBYmB-21XfmR2FdG-YWncKEEp-pE,42
|
|
15
|
+
ims_fieldupdater-3.0.3.dist-info/RECORD,,
|
ims/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__import__("pkg_resources").declare_namespace(__name__)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
#
|
ims/fieldupdater/tests/base.py
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import unittest
|
|
2
|
-
|
|
3
|
-
import transaction
|
|
4
|
-
from plone.app.testing import setRoles, TEST_USER_ID, SITE_OWNER_NAME, SITE_OWNER_PASSWORD
|
|
5
|
-
from plone.testing.zope import Browser
|
|
6
|
-
from zope.interface.declarations import directlyProvides
|
|
7
|
-
|
|
8
|
-
from .interfaces import IMassEditTest
|
|
9
|
-
from .. import testing
|
|
10
|
-
|
|
11
|
-
try:
|
|
12
|
-
from Products.CMFCore.indexing import processQueue
|
|
13
|
-
except ImportError:
|
|
14
|
-
def processQueue():
|
|
15
|
-
pass
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class UnitTestCase(unittest.TestCase):
|
|
19
|
-
def setUp(self):
|
|
20
|
-
pass
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class IntegrationTestCase(unittest.TestCase):
|
|
24
|
-
layer = testing.INTEGRATION
|
|
25
|
-
|
|
26
|
-
def setUp(self):
|
|
27
|
-
super(IntegrationTestCase, self).setUp()
|
|
28
|
-
self.portal = self.layer['portal']
|
|
29
|
-
self.request = self.layer
|
|
30
|
-
setRoles(self.portal, TEST_USER_ID, ['Manager'])
|
|
31
|
-
self.view = self.portal.restrictedTraverse('@@mass-edit')
|
|
32
|
-
self.portal.invokeFactory('Document', 'page1')
|
|
33
|
-
self.portal.invokeFactory('Document', 'page2')
|
|
34
|
-
|
|
35
|
-
self.page1 = self.portal['page1']
|
|
36
|
-
self.page2 = self.portal['page2']
|
|
37
|
-
directlyProvides(self.page1, IMassEditTest)
|
|
38
|
-
directlyProvides(self.page2, IMassEditTest)
|
|
39
|
-
self.page1.reindexObject()
|
|
40
|
-
self.page2.reindexObject()
|
|
41
|
-
processQueue()
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
class FunctionalTestCase(IntegrationTestCase):
|
|
45
|
-
layer = testing.FUNCTIONAL
|
|
46
|
-
|
|
47
|
-
def setUp(self):
|
|
48
|
-
super(FunctionalTestCase, self).setUp()
|
|
49
|
-
self.browser = Browser(self.layer['app'])
|
|
50
|
-
self.browser.handleErrors = False
|
|
51
|
-
self.browser.addHeader(
|
|
52
|
-
'Authorization',
|
|
53
|
-
'Basic %s:%s' % (SITE_OWNER_NAME, SITE_OWNER_PASSWORD,)
|
|
54
|
-
)
|
|
55
|
-
transaction.commit()
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
from zope.interface import Interface
|
|
2
|
-
from zope.schema import List, TextLine, Datetime, Date, Choice
|
|
3
|
-
from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
|
|
4
|
-
|
|
5
|
-
list_field_opts = SimpleVocabulary([
|
|
6
|
-
SimpleTerm(value='fermi', title='Fermi'),
|
|
7
|
-
SimpleTerm(value='einstein', title='Einstein'),
|
|
8
|
-
SimpleTerm(value='bohr', title='Bohr'),
|
|
9
|
-
SimpleTerm(value='heisenberg', title='Heisenberg'),
|
|
10
|
-
SimpleTerm(value='hawking', title='Hawking'),
|
|
11
|
-
])
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class IMassEditTest(Interface):
|
|
15
|
-
list_field = List(
|
|
16
|
-
title='List field',
|
|
17
|
-
value_type=TextLine(),
|
|
18
|
-
)
|
|
19
|
-
list_choice_field = List(
|
|
20
|
-
title='List choice field',
|
|
21
|
-
value_type=Choice(
|
|
22
|
-
vocabulary=list_field_opts,
|
|
23
|
-
)
|
|
24
|
-
)
|
|
25
|
-
text_field = TextLine(
|
|
26
|
-
title='Text field',
|
|
27
|
-
required=False,
|
|
28
|
-
)
|
|
29
|
-
text_field_required = TextLine(
|
|
30
|
-
title='Text field',
|
|
31
|
-
required=True
|
|
32
|
-
)
|
|
33
|
-
date_time_field = Datetime(
|
|
34
|
-
title='Datetime field',
|
|
35
|
-
)
|
|
36
|
-
date_field = Date(
|
|
37
|
-
title='Date field',
|
|
38
|
-
)
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
from zope.schema.interfaces import RequiredMissing
|
|
2
|
-
|
|
3
|
-
from . import base
|
|
4
|
-
from .interfaces import IMassEditTest
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class TestMassIntegration(base.IntegrationTestCase):
|
|
8
|
-
def test_schemas(self):
|
|
9
|
-
self.assertIn({'id': IMassEditTest.__identifier__, 'title': 'IMassEditTest'}, self.view.get_schemas())
|
|
10
|
-
|
|
11
|
-
def test_list_replace(self):
|
|
12
|
-
self.page1.list_field = ['einstein', 'bohr']
|
|
13
|
-
self.page2.list_field = ['fermi', 'heisenberg']
|
|
14
|
-
match = 'einstein'
|
|
15
|
-
field = 'list_field'
|
|
16
|
-
replacement = 'hawking'
|
|
17
|
-
schema = IMassEditTest.__identifier__
|
|
18
|
-
self.view.request['schema'] = schema
|
|
19
|
-
self.view.request['field'] = field
|
|
20
|
-
self.view.request['match'] = match
|
|
21
|
-
self.view.request['replacement'] = replacement
|
|
22
|
-
self.view.replace_term(schema, field, None, match)
|
|
23
|
-
self.assertEqual(self.page1.list_field, ['hawking', 'bohr'])
|
|
24
|
-
self.assertEqual(self.page2.list_field, ['fermi', 'heisenberg']) # sanity - no change
|
|
25
|
-
|
|
26
|
-
def test_list_delete(self):
|
|
27
|
-
self.page1.list_field = ['einstein', 'bohr']
|
|
28
|
-
self.page2.list_field = ['fermi', 'heisenberg']
|
|
29
|
-
match = 'einstein'
|
|
30
|
-
field = 'list_field'
|
|
31
|
-
schema = IMassEditTest.__identifier__
|
|
32
|
-
self.view.request['schema'] = schema
|
|
33
|
-
self.view.request['field'] = field
|
|
34
|
-
self.view.request['match'] = match
|
|
35
|
-
self.view.delete_term(schema, field, None, match)
|
|
36
|
-
self.assertEqual(self.page1.list_field, ['bohr'])
|
|
37
|
-
self.assertEqual(self.page2.list_field, ['fermi', 'heisenberg']) # sanity - no change
|
|
38
|
-
|
|
39
|
-
def test_list_replace_wrong_type(self):
|
|
40
|
-
""" str converted to unicode """
|
|
41
|
-
self.page1.list_field = ['einstein', 'bohr']
|
|
42
|
-
self.page2.list_field = ['fermi', 'heisenberg']
|
|
43
|
-
match = 'einstein'
|
|
44
|
-
field = 'list_field'
|
|
45
|
-
replacement = 'hawking'
|
|
46
|
-
schema = IMassEditTest.__identifier__
|
|
47
|
-
self.view.request['schema'] = schema
|
|
48
|
-
self.view.request['field'] = field
|
|
49
|
-
self.view.request['match'] = match
|
|
50
|
-
self.view.request['replacement'] = replacement
|
|
51
|
-
self.view.replace_term(schema, field, None, match)
|
|
52
|
-
self.assertEqual(self.page1.list_field, ['hawking', 'bohr'])
|
|
53
|
-
|
|
54
|
-
def test_list_choice_replace(self):
|
|
55
|
-
""" A term outside of vocab will come in as NO_VALUE and result in no change """
|
|
56
|
-
self.page1.list_choice_field = ['einstein', 'bohr']
|
|
57
|
-
self.page2.list_choice_field = ['fermi', 'heisenberg']
|
|
58
|
-
match = 'einstein'
|
|
59
|
-
field = 'list_choice_field'
|
|
60
|
-
replacement = 'hawking'
|
|
61
|
-
schema = IMassEditTest.__identifier__
|
|
62
|
-
self.view.request['schema'] = schema
|
|
63
|
-
self.view.request['field'] = field
|
|
64
|
-
self.view.request['match'] = match
|
|
65
|
-
self.view.request['replacement'] = replacement
|
|
66
|
-
self.view.replace_term(schema, field, None, match)
|
|
67
|
-
self.assertEqual(self.page1.list_choice_field, ['hawking', 'bohr'])
|
|
68
|
-
self.assertEqual(self.page2.list_choice_field, ['fermi', 'heisenberg']) # sanity - no change
|
|
69
|
-
|
|
70
|
-
def test_list_choice_replace_invalid(self):
|
|
71
|
-
self.page1.list_choice_field = ['einstein', 'bohr']
|
|
72
|
-
self.page2.list_choice_field = ['fermi', 'heisenberg']
|
|
73
|
-
match = 'einstein'
|
|
74
|
-
field = 'list_choice_field'
|
|
75
|
-
replacement = 'dirac'
|
|
76
|
-
schema = IMassEditTest.__identifier__
|
|
77
|
-
self.view.request['schema'] = schema
|
|
78
|
-
self.view.request['field'] = field
|
|
79
|
-
self.view.request['match'] = match
|
|
80
|
-
self.view.request['replacement'] = replacement
|
|
81
|
-
self.view.replace_term(schema, field, None, match)
|
|
82
|
-
self.assertNotIn('dirac', self.page1.list_choice_field)
|
|
83
|
-
|
|
84
|
-
def test_textline_replace(self):
|
|
85
|
-
self.page1.text_field = 'einstein'
|
|
86
|
-
match = 'einstein'
|
|
87
|
-
field = 'text_field'
|
|
88
|
-
replacement = 'hawking'
|
|
89
|
-
schema = IMassEditTest.__identifier__
|
|
90
|
-
self.view.request['schema'] = schema
|
|
91
|
-
self.view.request['field'] = field
|
|
92
|
-
self.view.request['match'] = match
|
|
93
|
-
self.view.request['replacement'] = replacement
|
|
94
|
-
self.view.replace_term(schema, field, None, match)
|
|
95
|
-
self.assertEqual(self.page1.text_field, 'hawking')
|
|
96
|
-
|
|
97
|
-
def test_textline_delete(self):
|
|
98
|
-
self.page1.text_field = 'einstein'
|
|
99
|
-
match = 'einstein'
|
|
100
|
-
field = 'text_field'
|
|
101
|
-
schema = IMassEditTest.__identifier__
|
|
102
|
-
self.view.request['schema'] = schema
|
|
103
|
-
self.view.request['field'] = field
|
|
104
|
-
self.view.request['match'] = match
|
|
105
|
-
self.view.delete_term(schema, field, None, match)
|
|
106
|
-
self.assertEqual(self.page1.text_field, None)
|
|
107
|
-
|
|
108
|
-
def test_textline_delete_required(self):
|
|
109
|
-
self.page1.text_field_required = 'einstein'
|
|
110
|
-
match = 'einstein'
|
|
111
|
-
field = 'text_field_required'
|
|
112
|
-
schema = IMassEditTest.__identifier__
|
|
113
|
-
self.view.request['schema'] = schema
|
|
114
|
-
self.view.request['field'] = field
|
|
115
|
-
self.view.request['match'] = match
|
|
116
|
-
self.assertRaises(RequiredMissing, self.view.delete_term, schema, field, None, match)
|
|
117
|
-
|
|
118
|
-
def test_unicode_conversion(self):
|
|
119
|
-
""" The widget should really handle this, but we do have this as a failsafe """
|
|
120
|
-
self.page1.text_field = 'einstein'
|
|
121
|
-
match = 'einstein'
|
|
122
|
-
field = 'text_field'
|
|
123
|
-
replacement = 'hawking'
|
|
124
|
-
schema = IMassEditTest.__identifier__
|
|
125
|
-
self.view.request['schema'] = schema
|
|
126
|
-
self.view.request['field'] = field
|
|
127
|
-
self.view.request['match'] = match
|
|
128
|
-
self.view.request['replacement'] = replacement
|
|
129
|
-
self.view.replace_term(schema, field, None, match)
|
|
130
|
-
self.assertEqual(self.page1.text_field, 'hawking')
|
|
131
|
-
self.assertIsInstance(self.page1.text_field, str)
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
class TestMassFunctional(base.FunctionalTestCase):
|
|
135
|
-
def test_mass_edit(self):
|
|
136
|
-
self.page1.list_choice_field = 'einstein'
|
|
137
|
-
self.browser.open(self.portal.absolute_url() + '/@@mass-edit?schema=' +
|
|
138
|
-
IMassEditTest.__identifier__ + '&field=list_choice_field&match=')
|
|
139
|
-
# ctrl = self.browser.getControl
|
|
140
|
-
# ctrl(name='form.buttons.search').click()
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
def test_suite():
|
|
144
|
-
import unittest
|
|
145
|
-
return unittest.defaultTestLoader.loadTestsFromName(__name__)
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
from Products.CMFPlone.utils import get_installer
|
|
2
|
-
from plone import api
|
|
3
|
-
from plone.app.testing import TEST_USER_ID
|
|
4
|
-
from plone.app.testing import setRoles
|
|
5
|
-
|
|
6
|
-
from . import base
|
|
7
|
-
from .. import testing
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class TestUninstall(base.IntegrationTestCase):
|
|
11
|
-
layer = testing.INTEGRATION
|
|
12
|
-
|
|
13
|
-
def setUp(self):
|
|
14
|
-
self.portal = self.layer['portal']
|
|
15
|
-
roles_before = api.user.get_roles(TEST_USER_ID)
|
|
16
|
-
setRoles(self.portal, TEST_USER_ID, ['Manager'])
|
|
17
|
-
self.installer = get_installer(self.portal)
|
|
18
|
-
self.installer.uninstall_product('ims.fieldupdater')
|
|
19
|
-
setRoles(self.portal, TEST_USER_ID, roles_before)
|
|
20
|
-
|
|
21
|
-
def test_product_uninstalled(self):
|
|
22
|
-
"""Test if ims.contacts is cleanly uninstalled."""
|
|
23
|
-
self.assertFalse(self.installer.is_product_installed('ims.fieldupdater'))
|