plone / plone.api

The Plone API
https://6.docs.plone.org/plone.api
Other
86 stars 53 forks source link

Use the dexterity machinery in api.content.create #484

Open ale-rt opened 2 years ago

ale-rt commented 2 years ago

Fixes #439

mister-roboto commented 2 years ago

@ale-rt thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

ale-rt commented 2 years ago

@jenkins-plone-org please run jobs

ale-rt commented 2 years ago

@jenkins-plone-org please run jobs

ale-rt commented 2 years ago

So far, it looks good to me, from looking at the code. Nice one with the context manager in the tests. :-)

Thanks for looking at it. I still see some issues, e.g. this test passes in master but not in this branch:

+     def test_create_document_subject(self):
+         "When passing the subject as a string, it should be saved as a tuple"
+         obj = api.content.create(
+             container=self.portal,
+             type="Dexterity Item",
+             id="foo",
+             subject="bar"
+         )
+         self.assertEqual(obj.subject, ("bar",))