Commit c41ace09 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Add a new test class for util module and move getNextTID() from master app test case to it.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1416 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 2e57160e
......@@ -44,15 +44,6 @@ class MasterAppTests(NeoTestBase):
self.failUnless(u64(self.app.loid) > 23)
self.assertEqual(u64(self.app.loid), 24)
def test_03_getNextTID(self):
self.assertEqual(self.app.ltid, None)
ntid = self.app.getNextTID()
self.assertEqual(self.app.ltid, ntid)
# generate new one
tid = self.app.getNextTID()
self.assertEqual(self.app.ltid, tid)
self.failUnless(tid > ntid)
def test_04_getPartition(self):
self.app.pt.num_partitions = 3
p = self.app.getPartition(p64(1))
......
#
# Copyright (C) 2006-2009 Nexedi SA
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import unittest
from neo.tests import NeoTestBase
from neo import util
class UtilTests(NeoTestBase):
def test_getNextTID(self):
tid0 = '\0' * 8
tid1 = util.getNextTID(tid0)
self.assertTrue(tid1 > tid0)
tid2 = util.getNextTID(tid1)
self.assertTrue(tid2 > tid1)
tidx = '\0' + chr(0xFF) * 7
tid3 = util.getNextTID(tidx)
self.assertTrue(tid3 > tidx)
if __name__ == "__main__":
unittest.main()
......@@ -33,6 +33,7 @@ UNIT_TEST_MODULES = [
'neo.tests.testNodes',
'neo.tests.testProtocol',
'neo.tests.testDispatcher',
'neo.tests.testUtil',
'neo.tests.testPT',
# master application
'neo.tests.master.testClientHandler',
......
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