def testHookError(self): bridge = DynamicBridge() with self.assertRaises(JsonRpcError) as e: bridge.dispatch('Host.ping')() self.assertEquals(e.exception.code, 100)
def testDefaultValues(self): bridge = DynamicBridge() params = {'storageType': 3, 'checkStatus': False} self.assertEqual(bridge.dispatch('Host.getDeviceList')(**params), [])
def testMethodWithNoParams(self): bridge = DynamicBridge() bridge.register_server_address('127.0.0.1') self.assertEquals(bridge.Host_getCapabilities()['My caps'], 'My capabilites') bridge.unregister_server_address()
def testMethodWithIntParam(self): bridge = DynamicBridge() params = {"vmID": "773adfc7-10d4-4e60-b700-3272ee1871f9", "params": {"vmID": "773adfc7-10d4-4e60-b700-3272ee1871f9"}, "incomingLimit": 42} self.assertEqual(bridge.dispatch('VM.migrationCreate')(**params), {'migrationPort': 0, 'params': {}})
def testDetach(self): bridge = DynamicBridge() params = {"storagepoolID": "00000002-0002-0002-0002-0000000000f6", "force": "True", "storagedomainID": "773adfc7-10d4-4e60-b700-3272ee1871f9"} self.assertEqual(bridge.dispatch('StorageDomain.detach')(**params), None)
def testMethodWithManyOptionalAttributes(self): bridge = DynamicBridge() params = {"addr": "rack05-pdu01-lab4.tlv.redhat.com", "port": "", "agent": "apc_snmp", "username": "******", "password": "******", "action": "off", "options": "port=15"} self.assertEquals(bridge.dispatch('Host.fenceNode')(**params), {'power': 'on'})
def testMethodWithManyOptionalAttributes(self): bridge = DynamicBridge() params = {"addr": "rack05-pdu01-lab4.tlv.redhat.com", "port": "", "agent": "apc_snmp", "username": "******", "password": "******", "action": "off", "options": "port=15"} self.assertEqual(bridge.dispatch('Host.fenceNode')(**params), {'power': 'on'})
def testMethodWithNoParams(self): bridge = DynamicBridge() bridge.register_server_address('127.0.0.1') self.assertEqual(bridge.dispatch('Host.getCapabilities')() ['My caps'], 'My capabilites') bridge.unregister_server_address()