Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_baseline not returning baseline in unit test? #48

Open
neilferreira opened this issue Jul 7, 2017 · 2 comments
Open

get_baseline not returning baseline in unit test? #48

neilferreira opened this issue Jul 7, 2017 · 2 comments

Comments

@neilferreira
Copy link

Hi all

I'm trying to write a regression test for a bug in iterate but I've hit a snag before I could even get started

    def test_workflow(self):
        import plone.api
        from plone.app.iterate.dexterity.utils import get_baseline

        parent = plone.api.content.create(
            self.portal, 'Document', 'Parent')
        child = plone.api.content.create(
            parent, 'Document', 'Child')

        # Make a checkout of the parent
        parent_wc = ICheckinCheckoutPolicy(parent).checkout(parent.aq_parent)
        self.assertEqual(get_baseline(parent_wc), parent)

This raises:

    self.assertEqual(get_baseline(parent_wc), parent)
  File "/usr/lib/python2.7/unittest/case.py", line 513, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/usr/lib/python2.7/unittest/case.py", line 506, in _baseAssertEqual
    raise self.failureException(msg)
AssertionError: None != <ATDocument at /plone/Parent>

Calling get_relations just returns []

Any ideas?

@cd250693
Copy link

Hey @neilferreira,

One way around this could be to simply call the url that creates a working copy. E.g.

parent.unrestrictedTraverse('@@make-changes')()

This does not return the working copy unfortunately, but will create a working copy properly. You can also cancel the changes in the same manner:

parent.unrestrictedTraverse('@@cancel-changes')()

@jensens
Copy link
Member

jensens commented Nov 16, 2017

related to #55 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants