Commit 2960dcf8 authored by Jérome Perrin's avatar Jérome Perrin Committed by Kazuhiko Shiozaki

testHalJsonStyle: fix _makeDocument with hash randomization.

With PYTHONHASHSEED=0, editing a document like this:

    foo.edit(
      title="live_test_%s" % new_id,
      reference="live_test_%s" % new_id
    )

only sets the reference, because it sets the reference first and then
when setting title it already has the "live_test_%s" % new_id value (
because title is acquired from reference).

With PYTHONHASHSEED set, the order is not guaranteed and sometimes
title is edited before reference. This is revealed by
testHalJsonStyle.TestERP5Document_getHateoas_mode_search with
PYTHONHASHSEED 465.
parent 57568465
...@@ -174,12 +174,9 @@ class ERP5HALJSONStyleSkinsMixin(ERP5TypeTestCase): ...@@ -174,12 +174,9 @@ class ERP5HALJSONStyleSkinsMixin(ERP5TypeTestCase):
def _makeDocument(self): def _makeDocument(self):
new_id = self.generateNewId() new_id = self.generateNewId()
foo = self.portal.foo_module.newContent(portal_type="Foo") return self.portal.foo_module.newContent(
foo.edit( portal_type="Foo",
title="live_test_%s" % new_id, reference="live_test_%s" % new_id)
reference="live_test_%s" % new_id
)
return foo
##################################################### #####################################################
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment