Esempio n. 1
0
    def testHookError(self):
        bridge = DynamicBridge()

        with self.assertRaises(JsonRpcError) as e:
            bridge.dispatch('Host.ping')()

        self.assertEquals(e.exception.code, 100)
Esempio n. 2
0
    def testDefaultValues(self):
        bridge = DynamicBridge()

        params = {'storageType': 3, 'checkStatus': False}

        self.assertEqual(bridge.dispatch('Host.getDeviceList')(**params),
                         [])
Esempio n. 3
0
    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()
Esempio n. 4
0
    def testHookError(self):
        bridge = DynamicBridge()

        with self.assertRaises(JsonRpcError) as e:
            bridge.dispatch('Host.ping')()

        self.assertEquals(e.exception.code, 100)
Esempio n. 5
0
    def testDefaultValues(self):
        bridge = DynamicBridge()

        params = {'storageType': 3, 'checkStatus': False}

        self.assertEqual(bridge.dispatch('Host.getDeviceList')(**params),
                         [])
Esempio n. 6
0
    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': {}})
Esempio n. 7
0
    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': {}})
Esempio n. 8
0
    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)
Esempio n. 9
0
    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'})
Esempio n. 10
0
    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)
Esempio n. 11
0
    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'})
Esempio n. 12
0
    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()