def test_basic(self):
     sot = server_remote_console.ServerRemoteConsole()
     self.assertEqual('remote_console', sot.resource_key)
     self.assertEqual('/servers/%(server_id)s/remote-consoles',
                      sot.base_path)
     self.assertTrue(sot.allow_create)
     self.assertFalse(sot.allow_fetch)
     self.assertFalse(sot.allow_commit)
     self.assertFalse(sot.allow_delete)
     self.assertFalse(sot.allow_list)
    def test_create_type_mks_old(self):
        sot = server_remote_console.ServerRemoteConsole(
            server_id='fake_server', type='webmks')

        class FakeEndpointData:
            min_microversion = '2'
            max_microversion = '2.5'

        self.sess.get_endpoint_data.return_value = FakeEndpointData()

        self.assertRaises(ValueError, sot.create, self.sess)
Exemplo n.º 3
0
    def test_create_console_mv_2_6(self, sgc, rcc, smv):
        console_fake = {'url': 'a', 'type': 'b', 'protocol': 'c'}

        # Test server_remote_console is triggered when mv>=2.6
        smv.return_value = True
        rcc.return_value = server_remote_console.ServerRemoteConsole(
            **console_fake)
        ret = self.proxy.create_console('fake_server', 'fake_type')
        smv.assert_called_once_with(self.proxy, '2.6')
        sgc.assert_not_called()
        rcc.assert_called_with(mock.ANY,
                               server_remote_console.ServerRemoteConsole,
                               server_id='fake_server',
                               type='fake_type',
                               protocol=None)
        self.assertEqual(console_fake['url'], ret['url'])
 def test_make_it(self):
     sot = server_remote_console.ServerRemoteConsole(**EXAMPLE)
     self.assertEqual(EXAMPLE['url'], sot.url)