Commit 91fc9bb7 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Fix node tests:

* Mock object doesn't not implement equality test, so use identity check
* Nodes state is now defaulted to UNKNOWN_STATE.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1281 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 753585fe
......@@ -37,12 +37,12 @@ class NodesTests(NeoTestBase):
server = ("127.0.0.1", 10000)
uuid = self.getNewUUID()
node = Node(server, uuid)
manager = Mock()
manager = Mock({'__repr__':'Fake Manager'})
node.setManager(manager)
self.assertEqual(node.state, UNKNOWN_STATE)
self.assertEqual(node.server, server)
self.assertEqual(node.uuid, uuid)
self.assertEqual(node.manager, manager)
self.assertTrue(node.manager is manager)
self.assertNotEqual(node.last_state_change, None)
# test getter
self.assertEqual(node.getState(), UNKNOWN_STATE)
......@@ -100,7 +100,7 @@ class NodesTests(NeoTestBase):
self.assertEqual(node.manager, None)
self.assertNotEqual(node.last_state_change, None)
# test getter
self.assertEqual(node.getState(), RUNNING_STATE)
self.assertEqual(node.getState(), UNKNOWN_STATE)
self.assertEqual(node.getServer(), server)
self.assertEqual(node.getUUID(), uuid)
self.assertEqual(MASTER_NODE_TYPE, node.getType())
......@@ -112,7 +112,7 @@ class NodesTests(NeoTestBase):
self.assertEqual(node.manager, None)
self.assertNotEqual(node.last_state_change, None)
# test getter
self.assertEqual(node.getState(), RUNNING_STATE)
self.assertEqual(node.getState(), UNKNOWN_STATE)
self.assertEqual(node.getServer(), server)
self.assertEqual(node.getUUID(), uuid)
self.assertEqual(STORAGE_NODE_TYPE, node.getType())
......@@ -124,7 +124,7 @@ class NodesTests(NeoTestBase):
self.assertEqual(node.manager, None)
self.assertNotEqual(node.last_state_change, None)
# test getter
self.assertEqual(node.getState(), RUNNING_STATE)
self.assertEqual(node.getState(), UNKNOWN_STATE)
self.assertEqual(node.getServer(), server)
self.assertEqual(node.getUUID(), uuid)
self.assertEqual(CLIENT_NODE_TYPE, node.getType())
......
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