Example #1
0
	def test_getDeferInstance__listfail(self):
		n=self.mocker.replace("cxm.node.Node.__init__")
		n("node1")
		n("node2")
		self.mocker.throw(Exception())
		self.mocker.replay()

		d=XenCluster.getDeferInstance(["node1","node2"])
		return self.assertFailure(d, cxm.xencluster.InstantiationError)
Example #2
0
	def test_getDeferInstance__listok(self):
		n=self.mocker.replace("cxm.node.Node.__init__")
		n("node1")
		n("node2")
		self.mocker.replay()

		d=XenCluster.getDeferInstance(["node1","node2"])
		d.addCallback(self.assertIsInstance, XenCluster)
		return d
Example #3
0
	def test_getDeferInstance__agentfail(self):
		a=self.mocker.replace("cxm.agent.Agent.__init__")
		a()
		getNodesList=self.mocker.replace("cxm.agent.Agent.getNodesList")
		getNodesList()
		self.mocker.result(defer.fail(Failure("some error",Exception)))
		self.mocker.replay()

		d=XenCluster.getDeferInstance()
		return self.assertFailure(d, Exception)
Example #4
0
	def test_getDeferInstance__agentok(self):
		a=self.mocker.replace("cxm.agent.Agent.__init__")
		a()
		getNodesList=self.mocker.replace("cxm.agent.Agent.getNodesList")
		getNodesList()
		self.mocker.result(defer.succeed(["node1","node2"]))
		n=self.mocker.replace("cxm.node.Node.__init__")
		n("node1")
		n("node2")
		self.mocker.replay()

		d=XenCluster.getDeferInstance()
		d.addCallback(self.assertIsInstance, XenCluster)
		return d