Commit 8eaffd51 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_erp5: Update testSlapOSWendelinCoreTwo

   Follow up changes done on the original commited on erp5 repository. The goal of this test is run against the full stack of slapos master.
parent aa2045d9
......@@ -2,6 +2,7 @@
##############################################################################
#
# Copyright (C) 2021 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com>
#
# This program is free software: you can Use, Study, Modify and Redistribute
# it under the terms of the GNU General Public License version 3, or (at your
......@@ -22,16 +23,15 @@
##############################################################################
from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
from wendelin import bigarray # pylint: disable=unused-import
from bigarray.array_zodb import ZBigArray
from numpy.testing import assert_array_equal
import transaction
from wendelin.bigarray import array_zodb
# Minimal test to make sure that wendelin.core works at all.
class TestSlapOSWendelinCoreBasic(SlapOSTestCaseMixin):
class TestWendelinCoreBasic(SlapOSTestCaseMixin):
def test(self):
ZBigArray = array_zodb.ZBigArray
# create the array in temporary "root" placeholder.
# NOTE we need created objects to enter ZODB for real, but
# newContent(temp_object=True) creates an object with ._p_jar=None
......@@ -43,28 +43,28 @@ class TestSlapOSWendelinCoreBasic(SlapOSTestCaseMixin):
# the array must initially read as all zeros
a = A[:]
self.assertEquals(a, [0,0,0,0])
assert_array_equal(a, [0,0,0,0])
b = A[:]
self.assertEquals(b, [0,0,0,0])
assert_array_equal(b, [0,0,0,0])
# we can assign items in a view, and the assignment propagates to another view
a[2] = 1
self.assertEquals(a, [0,0,1,0])
self.assertEquals(b, [0,0,1,0])
assert_array_equal(a, [0,0,1,0])
assert_array_equal(b, [0,0,1,0])
# on abort local changes are reverted
transaction.abort()
self.assertEquals(a, [0,0,0,0])
self.assertEquals(b, [0,0,0,0])
assert_array_equal(a, [0,0,0,0])
assert_array_equal(b, [0,0,0,0])
# on commit local changes are saved into ZODB
a[1] = 3
b[2] = 4
self.assertEquals(a, [0,3,4,0])
self.assertEquals(b, [0,3,4,0])
assert_array_equal(a, [0,3,4,0])
assert_array_equal(b, [0,3,4,0])
self.commit()
transaction.abort() # just in case
c = A[:]
self.assertEquals(a, [0,3,4,0])
self.assertEquals(b, [0,3,4,0])
self.assertEquals(c, [0,3,4,0])
assert_array_equal(a, [0,3,4,0])
assert_array_equal(b, [0,3,4,0])
assert_array_equal(c, [0,3,4,0])
\ No newline at end of file
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