Revision 19830e88

b/Makefile.am
1238 1238

  
1239 1239
python_tests = \
1240 1240
	doc/examples/rapi_testutils.py \
1241
	test/py/cmdlib/cluster_unittest.py \
1241 1242
	test/py/cmdlib/test_unittest.py \
1242 1243
	test/py/cfgupgrade_unittest.py \
1243 1244
	test/py/docs_unittest.py \
b/lib/objects.py
266 266
    """Implement __repr__ for ConfigObjects."""
267 267
    return repr(self.ToDict())
268 268

  
269
  def __eq__(self, other):
270
    """Implement __eq__ for ConfigObjects."""
271
    return isinstance(other, self.__class__) and self.ToDict() == other.ToDict()
272

  
269 273
  def UpgradeConfig(self):
270 274
    """Fill defaults for missing configuration values.
271 275

  
b/test/py/cmdlib/cluster_unittest.py
1
#!/usr/bin/python
2
#
3

  
4
# Copyright (C) 2013 Google Inc.
5
#
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
10
#
11
# This program is distributed in the hope that it will be useful, but
12
# WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
# General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
# 02110-1301, USA.
20

  
21

  
22
"""Tests for LUCluster*
23

  
24
"""
25

  
26
from ganeti import opcodes
27

  
28
from testsupport import *
29

  
30
import testutils
31

  
32

  
33
class TestLUClusterActivateMasterIp(CmdlibTestCase):
34
  def testSuccess(self):
35
    op = opcodes.OpClusterActivateMasterIp()
36

  
37
    self.rpc.call_node_activate_master_ip.return_value = \
38
      RpcResultsBuilder(cfg=self.cfg) \
39
        .CreateSuccessfulNodeResult(self.cfg.GetMasterNode())
40

  
41
    self.ExecOpCode(op)
42

  
43
    self.rpc.call_node_activate_master_ip.assert_called_once_with(
44
      self.cfg.GetMasterNode(),
45
      self.cfg.GetMasterNetworkParameters(),
46
      False)
47

  
48
  def testFailure(self):
49
    op = opcodes.OpClusterActivateMasterIp()
50

  
51
    self.rpc.call_node_activate_master_ip.return_value = \
52
      RpcResultsBuilder(cfg=self.cfg) \
53
        .CreateFailedNodeResult(self.cfg.GetMasterNode()) \
54

  
55
    self.ExecOpCodeExpectOpExecError(op)
56

  
57

  
58
if __name__ == "__main__":
59
  testutils.GanetiTestProgram()

Also available in: Unified diff