From 0f154a323aa6e2cf17751519c0ae771fbeceb4be Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Thu, 21 Sep 2023 15:01:43 +0200 Subject: [PATCH 01/22] run tests on python2 --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ecb653d15..847a57feb5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,8 @@ on: [push] jobs: build: runs-on: ubuntu-20.04 + container: + image: python:2.7.18-buster strategy: fail-fast: false matrix: From 4e0e30050ef64a26315412f6f18c0f297157aca8 Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Thu, 21 Sep 2023 15:09:24 +0200 Subject: [PATCH 02/22] run on 2.7 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 847a57feb5..439fef9262 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,8 +3,8 @@ on: [push] jobs: build: runs-on: ubuntu-20.04 - container: - image: python:2.7.18-buster + container: + image: python:2.7.18-buster strategy: fail-fast: false matrix: From be7ddd184b5a1266c2d05024d29fe9d0654f9f8f Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Thu, 21 Sep 2023 15:13:16 +0200 Subject: [PATCH 03/22] run on 2.7 --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 439fef9262..9c21ba54af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,6 +39,7 @@ jobs: uses: actions/setup-python@v1 with: python-version: ${{ matrix.python-version }} + architecture: x86 # python cache - uses: actions/cache@v1 From 52e697f66e5b7b0c9e85b7c89d31744ceaf3ca37 Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Sat, 7 Oct 2023 15:35:36 +0200 Subject: [PATCH 04/22] python --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c21ba54af..ba3d263316 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,9 +37,9 @@ jobs: # python setup - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v1 + if: ${{ matrix.python-version }} != 2.7 with: python-version: ${{ matrix.python-version }} - architecture: x86 # python cache - uses: actions/cache@v1 From 0e007bcd1905a53e68dd1cd5b2e289cdac24e2ec Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Sat, 7 Oct 2023 15:37:50 +0200 Subject: [PATCH 05/22] pythonv ersion --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba3d263316..43da37f1c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.8, 3.7, 3.6, 2.7] + python-version: [3.8, 3.7, 2.7] plone-version: [5.2, 5.1, 4.3] exclude: - python-version: 3.6 From a7d2646aa7efdb29dd34b2e09d5e4901ff078971 Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Sat, 7 Oct 2023 15:47:18 +0200 Subject: [PATCH 06/22] python version --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43da37f1c8..d59f5d8e16 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: # python setup - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v1 - if: ${{ matrix.python-version }} != 2.7 + if: ${{ matrix.python-version != 2.7 }} with: python-version: ${{ matrix.python-version }} From f402b770068332b5b9ccd8b00877285d151f29a5 Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Sat, 7 Oct 2023 15:54:00 +0200 Subject: [PATCH 07/22] pin version for python2 --- plone-4.3.x.cfg | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plone-4.3.x.cfg b/plone-4.3.x.cfg index 1278c56a8d..224d6f2c32 100644 --- a/plone-4.3.x.cfg +++ b/plone-4.3.x.cfg @@ -23,3 +23,7 @@ six = 1.12.0 # latest version compatible with Python 2 plone.schema = 1.4.0 + +# latest version compatible with Python 2 +sphinxcontrib_websupport = 1.1.2 + From 944acc74c3062918f25412864e7182baa12d8c8b Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Sat, 7 Oct 2023 16:01:13 +0200 Subject: [PATCH 08/22] pin version for python2 --- plone-4.3.x.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plone-4.3.x.cfg b/plone-4.3.x.cfg index 224d6f2c32..5e84eba356 100644 --- a/plone-4.3.x.cfg +++ b/plone-4.3.x.cfg @@ -26,4 +26,4 @@ plone.schema = 1.4.0 # latest version compatible with Python 2 sphinxcontrib_websupport = 1.1.2 - +stdlib-list = 0.6.0 From 32ea8065102ec35ea1f8cf6a7b11d2dc29abd5fd Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Sat, 7 Oct 2023 16:05:17 +0200 Subject: [PATCH 09/22] pin version for python2 --- plone-4.3.x.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plone-4.3.x.cfg b/plone-4.3.x.cfg index 5e84eba356..c746a21576 100644 --- a/plone-4.3.x.cfg +++ b/plone-4.3.x.cfg @@ -25,5 +25,5 @@ six = 1.12.0 plone.schema = 1.4.0 # latest version compatible with Python 2 -sphinxcontrib_websupport = 1.1.2 +sphinxcontrib-websupport = 1.1.2 stdlib-list = 0.6.0 From c79365a823517c533599820e9f93dc9998248d29 Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Sat, 7 Oct 2023 16:11:57 +0200 Subject: [PATCH 10/22] pin version for python2 --- plone-5.1.x.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/plone-5.1.x.cfg b/plone-5.1.x.cfg index edd3d53367..03f1fcdcc1 100644 --- a/plone-5.1.x.cfg +++ b/plone-5.1.x.cfg @@ -15,3 +15,4 @@ pyparsing = 2.4.7 # Required by plone.restapi six = 1.12.0 +stdlib-list = 0.6.0 \ No newline at end of file From 4004313733b3238a5acf09b4e47f75f21b4d7729 Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Sat, 7 Oct 2023 16:19:28 +0200 Subject: [PATCH 11/22] pin versions --- plone-4.3.x.cfg | 1 + plone-5.1.x.cfg | 3 ++- plone-5.2.x.cfg | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/plone-4.3.x.cfg b/plone-4.3.x.cfg index c746a21576..8d75c80da3 100644 --- a/plone-4.3.x.cfg +++ b/plone-4.3.x.cfg @@ -27,3 +27,4 @@ plone.schema = 1.4.0 # latest version compatible with Python 2 sphinxcontrib-websupport = 1.1.2 stdlib-list = 0.6.0 +zest.pocompile= 1.6.0 diff --git a/plone-5.1.x.cfg b/plone-5.1.x.cfg index 03f1fcdcc1..025bc5730b 100644 --- a/plone-5.1.x.cfg +++ b/plone-5.1.x.cfg @@ -15,4 +15,5 @@ pyparsing = 2.4.7 # Required by plone.restapi six = 1.12.0 -stdlib-list = 0.6.0 \ No newline at end of file +stdlib-list = 0.6.0 +zest.pocompile= 1.6.0 diff --git a/plone-5.2.x.cfg b/plone-5.2.x.cfg index cbd4374065..00e4cd406f 100644 --- a/plone-5.2.x.cfg +++ b/plone-5.2.x.cfg @@ -19,3 +19,4 @@ importlib-metadata = 2.0.0 # latest version compatible with Python 2 flake8-print = 4.0.1 +zest.pocompile= 1.6.0 From 0c3987ed23e9461cdc941e6c1b726c6dd57db602 Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Sat, 7 Oct 2023 16:44:45 +0200 Subject: [PATCH 12/22] pin versin --- plone-4.3.x.cfg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plone-4.3.x.cfg b/plone-4.3.x.cfg index 8d75c80da3..2ab09b9c68 100644 --- a/plone-4.3.x.cfg +++ b/plone-4.3.x.cfg @@ -27,4 +27,5 @@ plone.schema = 1.4.0 # latest version compatible with Python 2 sphinxcontrib-websupport = 1.1.2 stdlib-list = 0.6.0 -zest.pocompile= 1.6.0 +zest.pocompile = 1.6.0 +plone.rest = 3.0.1 From c744597044be3f45f6df6b1dbfc1ee4ad9d4a324 Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Sat, 7 Oct 2023 17:04:56 +0200 Subject: [PATCH 13/22] hashFiles changes --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d59f5d8e16..b146153a23 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,7 +45,7 @@ jobs: - uses: actions/cache@v1 with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- From 7e25b8791977b3f68843353b4d5e9dba4a6a3499 Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Sat, 7 Oct 2023 17:16:04 +0200 Subject: [PATCH 14/22] pin versin --- plone-5.1.x.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/plone-5.1.x.cfg b/plone-5.1.x.cfg index 025bc5730b..5b30c2da1b 100644 --- a/plone-5.1.x.cfg +++ b/plone-5.1.x.cfg @@ -17,3 +17,4 @@ pyparsing = 2.4.7 six = 1.12.0 stdlib-list = 0.6.0 zest.pocompile= 1.6.0 +plone.rest = 3.0.1 From 39eb95c9dd5e9d58a81bbc050057876457f404f0 Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Sat, 7 Oct 2023 17:31:06 +0200 Subject: [PATCH 15/22] pin versin --- plone-4.3.x.cfg | 2 +- plone-5.1.x.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plone-4.3.x.cfg b/plone-4.3.x.cfg index 2ab09b9c68..6c5e89d6c5 100644 --- a/plone-4.3.x.cfg +++ b/plone-4.3.x.cfg @@ -28,4 +28,4 @@ plone.schema = 1.4.0 sphinxcontrib-websupport = 1.1.2 stdlib-list = 0.6.0 zest.pocompile = 1.6.0 -plone.rest = 3.0.1 +plone.rest = 3.0.2 diff --git a/plone-5.1.x.cfg b/plone-5.1.x.cfg index 5b30c2da1b..8854696f9a 100644 --- a/plone-5.1.x.cfg +++ b/plone-5.1.x.cfg @@ -17,4 +17,4 @@ pyparsing = 2.4.7 six = 1.12.0 stdlib-list = 0.6.0 zest.pocompile= 1.6.0 -plone.rest = 3.0.1 +plone.rest = 3.0.2 From 35c5c3b2788788b4a709358f3fb58240a1b6f89c Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Sat, 7 Oct 2023 17:44:03 +0200 Subject: [PATCH 16/22] changelog --- news/1721.feature | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 news/1721.feature diff --git a/news/1721.feature b/news/1721.feature new file mode 100644 index 0000000000..e656fa9b2c --- /dev/null +++ b/news/1721.feature @@ -0,0 +1,2 @@ +New version pins to run tests +[erral] From d49850f502d932b1e684032539db5939d3ff59c8 Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Sat, 7 Oct 2023 18:54:16 +0200 Subject: [PATCH 17/22] use DXTestDocument to run tests --- .../restapi/tests/test_services_types.py | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/plone/restapi/tests/test_services_types.py b/src/plone/restapi/tests/test_services_types.py index 040204f996..73a2de420e 100644 --- a/src/plone/restapi/tests/test_services_types.py +++ b/src/plone/restapi/tests/test_services_types.py @@ -26,7 +26,7 @@ def setUp(self): self.api_session.auth = (SITE_OWNER_NAME, SITE_OWNER_PASSWORD) self.api_session.post( - "/@types/Document", + "/@types/DXTestDocument", json={ "factory": "fieldset", "title": "Contact Info", @@ -35,7 +35,7 @@ def setUp(self): ) self.api_session.post( - "/@types/Document", + "/@types/DXTestDocument", json={ "factory": "fieldset", "title": "Location", @@ -44,7 +44,7 @@ def setUp(self): ) self.api_session.post( - "/@types/Document", + "/@types/DXTestDocument", json={ "factory": "Email", "title": "Author email", @@ -53,7 +53,7 @@ def setUp(self): ) self.api_session.post( - "/@types/Document", + "/@types/DXTestDocument", json={ "factory": "URL", "title": "Author url", @@ -63,7 +63,7 @@ def setUp(self): def tearDown(self): # Remove all custom changed on Document - self.api_session.put("/@types/Document", json={}) + self.api_session.put("/@types/DXTestDocument", json={}) self.api_session.close() def test_get_types(self): @@ -84,7 +84,7 @@ def test_get_types(self): def test_get_types_document(self): response = self.api_session.get( - "{}/@types/Document".format(self.portal.absolute_url()) + "{}/@types/DXTestDocument".format(self.portal.absolute_url()) ) self.assertEqual(response.status_code, 200) @@ -97,7 +97,7 @@ def test_get_types_document(self): ) def test_get_types_document_edit(self): - response = self.api_session.get("/@types/Document") + response = self.api_session.get("/@types/DXTestDocument") self.assertEqual(response.status_code, 200) @@ -114,7 +114,7 @@ def test_get_types_document_edit(self): ) # noqa def test_types_document_get_fieldset(self): - response = self.api_session.get("/@types/Document/contact_info") + response = self.api_session.get("/@types/DXTestDocument/contact_info") self.assertEqual(response.status_code, 200) self.assertEqual("Contact Info", response.json().get("title")) @@ -125,7 +125,7 @@ def test_types_document_get_fieldset(self): self.assertEqual([], response.json().get("fields")) def test_types_document_get_field(self): - response = self.api_session.get("/@types/Document/author_email") + response = self.api_session.get("/@types/DXTestDocument/author_email") self.assertEqual(response.status_code, 200) self.assertEqual("Author email", response.json().get("title")) # noqa @@ -142,7 +142,7 @@ def test_types_document_get_field(self): def test_types_document_post_fieldset(self): response = self.api_session.post( - "/@types/Document", + "/@types/DXTestDocument", json={ "factory": "fieldset", "title": "Foo bar", @@ -158,7 +158,7 @@ def test_types_document_post_fieldset(self): def test_types_document_post_field(self): response = self.api_session.post( - "/@types/Document", + "/@types/DXTestDocument", json={ "factory": "Email", "title": "Email", @@ -180,7 +180,7 @@ def test_types_document_post_field(self): def test_types_document_patch_properties(self): response = self.api_session.patch( - "/@types/Document", + "/@types/DXTestDocument", json={ "properties": { "author_email": { @@ -194,7 +194,7 @@ def test_types_document_patch_properties(self): # PATCH returns no content self.assertEqual(response.status_code, 204) - response = self.api_session.get("/@types/Document/author_email") + response = self.api_session.get("/@types/DXTestDocument/author_email") self.assertEqual(200, response.status_code) self.assertEqual("foo@bar.com", response.json().get("default")) self.assertEqual(5, response.json().get("minLength")) @@ -202,7 +202,7 @@ def test_types_document_patch_properties(self): def test_types_document_patch_fieldsets(self): response = self.api_session.patch( - "/@types/Document", + "/@types/DXTestDocument", json={ "fieldsets": [ { @@ -215,14 +215,14 @@ def test_types_document_patch_fieldsets(self): ) self.assertEqual(response.status_code, 204) - response = self.api_session.get("/@types/Document/contact_info") + response = self.api_session.get("/@types/DXTestDocument/contact_info") self.assertEqual(200, response.status_code) self.assertEqual("Contact information", response.json().get("title")) self.assertEqual(["author_email"], response.json().get("fields")) def test_types_document_patch_one_fieldset(self): response = self.api_session.patch( - "/@types/Document/contact_info", + "/@types/DXTestDocument/contact_info", json={ "title": "Contact the author", "description": "Reach the author", @@ -234,7 +234,7 @@ def test_types_document_patch_one_fieldset(self): ) self.assertEqual(response.status_code, 204) - response = self.api_session.get("/@types/Document/contact_info") + response = self.api_session.get("/@types/DXTestDocument/contact_info") self.assertEqual(200, response.status_code) self.assertEqual("Contact the author", response.json().get("title")) self.assertEqual("Reach the author", response.json().get("description")) # noqa @@ -244,7 +244,7 @@ def test_types_document_patch_one_fieldset(self): def test_types_document_patch_one_field(self): response = self.api_session.patch( - "/@types/Document/author_email", + "/@types/DXTestDocument/author_email", json={ "title": "Author e-mail", "description": "The e-mail address of the author", @@ -255,7 +255,7 @@ def test_types_document_patch_one_field(self): ) self.assertEqual(response.status_code, 204) - response = self.api_session.get("/@types/Document/author_email") + response = self.api_session.get("/@types/DXTestDocument/author_email") self.assertEqual(200, response.status_code) self.assertEqual("Author e-mail", response.json().get("title")) self.assertEqual( @@ -266,7 +266,7 @@ def test_types_document_patch_one_field(self): def test_types_document_patch_create_missing(self): response = self.api_session.patch( - "/@types/Document", + "/@types/DXTestDocument", json={ "fieldsets": [ {"title": "Layout", "fields": ["blocks", "blocks_layout"]} @@ -319,7 +319,7 @@ def test_types_document_patch_create_missing(self): ) self.assertEqual(response.status_code, 204) - response = self.api_session.get("/@types/Document") + response = self.api_session.get("/@types/DXTestDocument") self.assertEqual(200, response.status_code) self.assertIn("blocks", response.json().get("properties")) @@ -332,7 +332,7 @@ def test_types_document_patch_create_missing(self): def test_types_document_update_min_max(self): response = self.api_session.patch( - "/@types/Document", + "/@types/DXTestDocument", json={ "properties": { "custom_text": { @@ -352,18 +352,18 @@ def test_types_document_update_min_max(self): ) self.assertEqual(response.status_code, 204) - response = self.api_session.get("/@types/Document/custom_text") + response = self.api_session.get("/@types/DXTestDocument/custom_text") self.assertEqual(200, response.status_code) self.assertEqual(2, response.json().get("minLength")) self.assertEqual(20, response.json().get("maxLength")) - response = self.api_session.get("/@types/Document/custom_float") + response = self.api_session.get("/@types/DXTestDocument/custom_float") self.assertEqual(200, response.status_code) self.assertEqual(2, response.json().get("minimum")) self.assertEqual(14.0, response.json().get("maximum")) def test_types_document_put(self): - response = self.api_session.get("/@types/Document") + response = self.api_session.get("/@types/DXTestDocument") doc_json = response.json() doc_json["layouts"] = ["thumbnail_view", "table_view"] doc_json["fieldsets"] = [ @@ -388,10 +388,10 @@ def test_types_document_put(self): "default": None, } - response = self.api_session.put("/@types/Document", json=doc_json) + response = self.api_session.put("/@types/DXTestDocument", json=doc_json) self.assertEqual(response.status_code, 204) - response = self.api_session.get("/@types/Document") + response = self.api_session.get("/@types/DXTestDocument") self.assertEqual(200, response.status_code) # Layouts updated @@ -427,22 +427,22 @@ def test_types_document_put(self): def test_types_document_remove_field(self): response = self.api_session.delete( - "/@types/Document/author_email", + "/@types/DXTestDocument/author_email", ) self.assertEqual(response.status_code, 204) - response = self.api_session.get("/@types/Document") + response = self.api_session.get("/@types/DXTestDocument") self.assertEqual(200, response.status_code) self.assertTrue("author_email" not in response.json().get("properties")) # noqa def test_types_document_remove_fieldset(self): response = self.api_session.delete( - "/@types/Document/contact_info", + "/@types/DXTestDocument/contact_info", ) self.assertEqual(response.status_code, 204) - response = self.api_session.get("/@types/Document") + response = self.api_session.get("/@types/DXTestDocument") self.assertEqual(200, response.status_code) self.assertTrue( From 7b94081a41859c3eb720d12a44b4d6b4a1a77f8b Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Sun, 8 Oct 2023 09:14:03 +0200 Subject: [PATCH 18/22] check field None --- src/plone/restapi/tests/test_dxfield_serializer.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/plone/restapi/tests/test_dxfield_serializer.py b/src/plone/restapi/tests/test_dxfield_serializer.py index 288992b8fb..3965aceaee 100644 --- a/src/plone/restapi/tests/test_dxfield_serializer.py +++ b/src/plone/restapi/tests/test_dxfield_serializer.py @@ -41,14 +41,18 @@ def setUp(self): ] def serialize(self, fieldname, value): + field = None for schema in iterSchemata(self.doc1): if fieldname in schema: field = schema.get(fieldname) break - dm = getMultiAdapter((self.doc1, field), IDataManager) - dm.set(value) - serializer = getMultiAdapter((field, self.doc1, self.request), IFieldSerializer) - return serializer() + if field is not None: + dm = getMultiAdapter((self.doc1, field), IDataManager) + dm.set(value) + serializer = getMultiAdapter((field, self.doc1, self.request), IFieldSerializer) + return serializer() + + return None def test_ascii_field_serialization_returns_unicode(self): value = self.serialize("test_ascii_field", "foo") From 0a1e339d27a504926805d19680940e037b9e3944 Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Sun, 8 Oct 2023 09:51:15 +0200 Subject: [PATCH 19/22] back to Document --- .../restapi/tests/test_services_types.py | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/plone/restapi/tests/test_services_types.py b/src/plone/restapi/tests/test_services_types.py index 73a2de420e..040204f996 100644 --- a/src/plone/restapi/tests/test_services_types.py +++ b/src/plone/restapi/tests/test_services_types.py @@ -26,7 +26,7 @@ def setUp(self): self.api_session.auth = (SITE_OWNER_NAME, SITE_OWNER_PASSWORD) self.api_session.post( - "/@types/DXTestDocument", + "/@types/Document", json={ "factory": "fieldset", "title": "Contact Info", @@ -35,7 +35,7 @@ def setUp(self): ) self.api_session.post( - "/@types/DXTestDocument", + "/@types/Document", json={ "factory": "fieldset", "title": "Location", @@ -44,7 +44,7 @@ def setUp(self): ) self.api_session.post( - "/@types/DXTestDocument", + "/@types/Document", json={ "factory": "Email", "title": "Author email", @@ -53,7 +53,7 @@ def setUp(self): ) self.api_session.post( - "/@types/DXTestDocument", + "/@types/Document", json={ "factory": "URL", "title": "Author url", @@ -63,7 +63,7 @@ def setUp(self): def tearDown(self): # Remove all custom changed on Document - self.api_session.put("/@types/DXTestDocument", json={}) + self.api_session.put("/@types/Document", json={}) self.api_session.close() def test_get_types(self): @@ -84,7 +84,7 @@ def test_get_types(self): def test_get_types_document(self): response = self.api_session.get( - "{}/@types/DXTestDocument".format(self.portal.absolute_url()) + "{}/@types/Document".format(self.portal.absolute_url()) ) self.assertEqual(response.status_code, 200) @@ -97,7 +97,7 @@ def test_get_types_document(self): ) def test_get_types_document_edit(self): - response = self.api_session.get("/@types/DXTestDocument") + response = self.api_session.get("/@types/Document") self.assertEqual(response.status_code, 200) @@ -114,7 +114,7 @@ def test_get_types_document_edit(self): ) # noqa def test_types_document_get_fieldset(self): - response = self.api_session.get("/@types/DXTestDocument/contact_info") + response = self.api_session.get("/@types/Document/contact_info") self.assertEqual(response.status_code, 200) self.assertEqual("Contact Info", response.json().get("title")) @@ -125,7 +125,7 @@ def test_types_document_get_fieldset(self): self.assertEqual([], response.json().get("fields")) def test_types_document_get_field(self): - response = self.api_session.get("/@types/DXTestDocument/author_email") + response = self.api_session.get("/@types/Document/author_email") self.assertEqual(response.status_code, 200) self.assertEqual("Author email", response.json().get("title")) # noqa @@ -142,7 +142,7 @@ def test_types_document_get_field(self): def test_types_document_post_fieldset(self): response = self.api_session.post( - "/@types/DXTestDocument", + "/@types/Document", json={ "factory": "fieldset", "title": "Foo bar", @@ -158,7 +158,7 @@ def test_types_document_post_fieldset(self): def test_types_document_post_field(self): response = self.api_session.post( - "/@types/DXTestDocument", + "/@types/Document", json={ "factory": "Email", "title": "Email", @@ -180,7 +180,7 @@ def test_types_document_post_field(self): def test_types_document_patch_properties(self): response = self.api_session.patch( - "/@types/DXTestDocument", + "/@types/Document", json={ "properties": { "author_email": { @@ -194,7 +194,7 @@ def test_types_document_patch_properties(self): # PATCH returns no content self.assertEqual(response.status_code, 204) - response = self.api_session.get("/@types/DXTestDocument/author_email") + response = self.api_session.get("/@types/Document/author_email") self.assertEqual(200, response.status_code) self.assertEqual("foo@bar.com", response.json().get("default")) self.assertEqual(5, response.json().get("minLength")) @@ -202,7 +202,7 @@ def test_types_document_patch_properties(self): def test_types_document_patch_fieldsets(self): response = self.api_session.patch( - "/@types/DXTestDocument", + "/@types/Document", json={ "fieldsets": [ { @@ -215,14 +215,14 @@ def test_types_document_patch_fieldsets(self): ) self.assertEqual(response.status_code, 204) - response = self.api_session.get("/@types/DXTestDocument/contact_info") + response = self.api_session.get("/@types/Document/contact_info") self.assertEqual(200, response.status_code) self.assertEqual("Contact information", response.json().get("title")) self.assertEqual(["author_email"], response.json().get("fields")) def test_types_document_patch_one_fieldset(self): response = self.api_session.patch( - "/@types/DXTestDocument/contact_info", + "/@types/Document/contact_info", json={ "title": "Contact the author", "description": "Reach the author", @@ -234,7 +234,7 @@ def test_types_document_patch_one_fieldset(self): ) self.assertEqual(response.status_code, 204) - response = self.api_session.get("/@types/DXTestDocument/contact_info") + response = self.api_session.get("/@types/Document/contact_info") self.assertEqual(200, response.status_code) self.assertEqual("Contact the author", response.json().get("title")) self.assertEqual("Reach the author", response.json().get("description")) # noqa @@ -244,7 +244,7 @@ def test_types_document_patch_one_fieldset(self): def test_types_document_patch_one_field(self): response = self.api_session.patch( - "/@types/DXTestDocument/author_email", + "/@types/Document/author_email", json={ "title": "Author e-mail", "description": "The e-mail address of the author", @@ -255,7 +255,7 @@ def test_types_document_patch_one_field(self): ) self.assertEqual(response.status_code, 204) - response = self.api_session.get("/@types/DXTestDocument/author_email") + response = self.api_session.get("/@types/Document/author_email") self.assertEqual(200, response.status_code) self.assertEqual("Author e-mail", response.json().get("title")) self.assertEqual( @@ -266,7 +266,7 @@ def test_types_document_patch_one_field(self): def test_types_document_patch_create_missing(self): response = self.api_session.patch( - "/@types/DXTestDocument", + "/@types/Document", json={ "fieldsets": [ {"title": "Layout", "fields": ["blocks", "blocks_layout"]} @@ -319,7 +319,7 @@ def test_types_document_patch_create_missing(self): ) self.assertEqual(response.status_code, 204) - response = self.api_session.get("/@types/DXTestDocument") + response = self.api_session.get("/@types/Document") self.assertEqual(200, response.status_code) self.assertIn("blocks", response.json().get("properties")) @@ -332,7 +332,7 @@ def test_types_document_patch_create_missing(self): def test_types_document_update_min_max(self): response = self.api_session.patch( - "/@types/DXTestDocument", + "/@types/Document", json={ "properties": { "custom_text": { @@ -352,18 +352,18 @@ def test_types_document_update_min_max(self): ) self.assertEqual(response.status_code, 204) - response = self.api_session.get("/@types/DXTestDocument/custom_text") + response = self.api_session.get("/@types/Document/custom_text") self.assertEqual(200, response.status_code) self.assertEqual(2, response.json().get("minLength")) self.assertEqual(20, response.json().get("maxLength")) - response = self.api_session.get("/@types/DXTestDocument/custom_float") + response = self.api_session.get("/@types/Document/custom_float") self.assertEqual(200, response.status_code) self.assertEqual(2, response.json().get("minimum")) self.assertEqual(14.0, response.json().get("maximum")) def test_types_document_put(self): - response = self.api_session.get("/@types/DXTestDocument") + response = self.api_session.get("/@types/Document") doc_json = response.json() doc_json["layouts"] = ["thumbnail_view", "table_view"] doc_json["fieldsets"] = [ @@ -388,10 +388,10 @@ def test_types_document_put(self): "default": None, } - response = self.api_session.put("/@types/DXTestDocument", json=doc_json) + response = self.api_session.put("/@types/Document", json=doc_json) self.assertEqual(response.status_code, 204) - response = self.api_session.get("/@types/DXTestDocument") + response = self.api_session.get("/@types/Document") self.assertEqual(200, response.status_code) # Layouts updated @@ -427,22 +427,22 @@ def test_types_document_put(self): def test_types_document_remove_field(self): response = self.api_session.delete( - "/@types/DXTestDocument/author_email", + "/@types/Document/author_email", ) self.assertEqual(response.status_code, 204) - response = self.api_session.get("/@types/DXTestDocument") + response = self.api_session.get("/@types/Document") self.assertEqual(200, response.status_code) self.assertTrue("author_email" not in response.json().get("properties")) # noqa def test_types_document_remove_fieldset(self): response = self.api_session.delete( - "/@types/DXTestDocument/contact_info", + "/@types/Document/contact_info", ) self.assertEqual(response.status_code, 204) - response = self.api_session.get("/@types/DXTestDocument") + response = self.api_session.get("/@types/Document") self.assertEqual(200, response.status_code) self.assertTrue( From e8524ae35e6454223c5735a7a0583124be534c1e Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Sun, 8 Oct 2023 09:58:43 +0200 Subject: [PATCH 20/22] black --- src/plone/restapi/tests/test_dxfield_serializer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plone/restapi/tests/test_dxfield_serializer.py b/src/plone/restapi/tests/test_dxfield_serializer.py index 3965aceaee..0562a25d6e 100644 --- a/src/plone/restapi/tests/test_dxfield_serializer.py +++ b/src/plone/restapi/tests/test_dxfield_serializer.py @@ -49,7 +49,9 @@ def serialize(self, fieldname, value): if field is not None: dm = getMultiAdapter((self.doc1, field), IDataManager) dm.set(value) - serializer = getMultiAdapter((field, self.doc1, self.request), IFieldSerializer) + serializer = getMultiAdapter( + (field, self.doc1, self.request), IFieldSerializer + ) return serializer() return None From 32fbe748727a5b096c06d091bc08324398decbe8 Mon Sep 17 00:00:00 2001 From: David Glick Date: Sat, 14 Oct 2023 12:05:26 -0700 Subject: [PATCH 21/22] Test docs on Python 3.8 instead of 3.7 --- test-no-uncommitted-doc-changes.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test-no-uncommitted-doc-changes.in b/test-no-uncommitted-doc-changes.in index 43e15b81f1..c2ad9929e4 100644 --- a/test-no-uncommitted-doc-changes.in +++ b/test-no-uncommitted-doc-changes.in @@ -13,12 +13,12 @@ function red { echo "$RED $1 $RESET" } -if [ "$PLONE_VERSION" == "5.2" ] && [ "$PYTHON_VERSION" == '3.7' ]; then - echo "Running check for undocumented changes for Plone 5.2.x on Python 3.7" +if [ "$PLONE_VERSION" == "5.2" ] && [ "$PYTHON_VERSION" == '3.8' ]; then + echo "Running check for undocumented changes for Plone 5.2.x on Python 3.8" else # request/response dumps have known differences for Plone 5 # => skip, we can't have the Plone 5 build fail because of those - echo "Skipping checks for undocumented changes for everything except Plone 5.2.x on Python 3.7" + echo "Skipping checks for undocumented changes for everything except Plone 5.2.x on Python 3.8" exit 0 fi From c85ff9ad98527a1c284c02504a6a0a410de07654 Mon Sep 17 00:00:00 2001 From: David Glick Date: Sat, 14 Oct 2023 13:21:09 -0700 Subject: [PATCH 22/22] split jobs for python3 and python2; it was always running 2.7 before --- .github/workflows/ci.yml | 79 +++++++++++++++++++++++++++------------- 1 file changed, 53 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b146153a23..f0cf2a144a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,32 +3,11 @@ on: [push] jobs: build: runs-on: ubuntu-20.04 - container: - image: python:2.7.18-buster strategy: fail-fast: false matrix: - python-version: [3.8, 3.7, 2.7] - plone-version: [5.2, 5.1, 4.3] - exclude: - - python-version: 3.6 - plone-version: 4.3 - - python-version: 3.6 - plone-version: 5.0 - - python-version: 3.6 - plone-version: 5.1 - - python-version: 3.7 - plone-version: 4.3 - - python-version: 3.7 - plone-version: 5.0 - - python-version: 3.7 - plone-version: 5.1 - - python-version: 3.8 - plone-version: 4.3 - - python-version: 3.8 - plone-version: 5.0 - - python-version: 3.8 - plone-version: 5.1 + python-version: [3.8, 3.7] + plone-version: [5.2] steps: # git checkout @@ -37,7 +16,6 @@ jobs: # python setup - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v1 - if: ${{ matrix.python-version != 2.7 }} with: python-version: ${{ matrix.python-version }} @@ -67,7 +45,7 @@ jobs: # build sphinx - name: sphinx - run: if [ "${{ matrix.plone-version }}" == "5.2" ] && [ ${{ matrix.python-version }} == '3.7' ]; then bin/sphinxbuilder; fi + run: if [ "${{ matrix.plone-version }}" == "5.2" ] && [ ${{ matrix.python-version }} == '3.8' ]; then bin/sphinxbuilder; fi # test - name: test @@ -82,4 +60,53 @@ jobs: # test sphinx warnings - name: sphinx - run: if [ "${{ matrix.plone-version }}" == "5.2" ] && [ ${{ matrix.python-version }} == '3.7' ]; then bin/test-no-sphinx-warnings; fi + run: if [ "${{ matrix.plone-version }}" == "5.2" ] && [ ${{ matrix.python-version }} == '3.8' ]; then bin/test-no-sphinx-warnings; fi + + build-py2: + runs-on: ubuntu-20.04 + container: + image: python:2.7.18-buster + strategy: + fail-fast: false + matrix: + python-version: [2.7] + plone-version: [5.2, 5.1, 4.3] + + steps: + # git checkout + - uses: actions/checkout@v2 + + # python cache + - uses: actions/cache@v1 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + # python install + - run: pip install virtualenv + - run: pip install wheel + - name: pip install + run: pip install -r requirements.txt + + # buildout + - name: buildout + run: buildout -t 10 -c plone-${{ matrix.plone-version }}.x.cfg code-analysis:return-status-codes=True + env: + CI: true + + # code analysis + - name: code analysis + run: bin/code-analysis + + # test + - name: test + run: bin/test + + # test no uncommited changes + - name: test no uncommited changes + run: bin/test-no-uncommitted-doc-changes + env: + PYTHON_VERSION: ${{ matrix.python-version }} + PLONE_VERSION: ${{ matrix.plone-version }}