当前位置: 首页>>代码示例>>Python>>正文


Python ProfitBricksService.attach_cdrom方法代码示例

本文整理汇总了Python中profitbricks.client.ProfitBricksService.attach_cdrom方法的典型用法代码示例。如果您正苦于以下问题:Python ProfitBricksService.attach_cdrom方法的具体用法?Python ProfitBricksService.attach_cdrom怎么用?Python ProfitBricksService.attach_cdrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在profitbricks.client.ProfitBricksService的用法示例。


在下文中一共展示了ProfitBricksService.attach_cdrom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestServer

# 需要导入模块: from profitbricks.client import ProfitBricksService [as 别名]
# 或者: from profitbricks.client.ProfitBricksService import attach_cdrom [as 别名]

#.........这里部分代码省略.........
                         'Ubuntu image description')
        self.assertEqual(servers['items'][0]['properties']['location'], 'de/fkb')
        self.assertEqual(servers['items'][0]['properties']['imageType'], 'CDROM')
        self.assertEqual(servers['items'][0]['properties']['licenceType'], 'UNKNOWN')
        self.assertFalse(servers['items'][0]['properties']['public'])
        self.assertFalse(servers['items'][0]['properties']['cpuHotPlug'])
        self.assertFalse(servers['items'][0]['properties']['cpuHotUnplug'])
        self.assertFalse(servers['items'][0]['properties']['ramHotPlug'])
        self.assertFalse(servers['items'][0]['properties']['ramHotUnplug'])
        self.assertFalse(servers['items'][0]['properties']['nicHotPlug'])
        self.assertFalse(servers['items'][0]['properties']['nicHotUnplug'])
        self.assertFalse(servers['items'][0]['properties']['discVirtioHotPlug'])
        self.assertFalse(servers['items'][0]['properties']['discVirtioHotUnplug'])
        self.assertFalse(servers['items'][0]['properties']['discScsiHotPlug'])
        self.assertFalse(servers['items'][0]['properties']['discScsiHotUnplug'])

    def test_get_attached_cdrom(self):
        cdrom_id = '7df81087-5835-41c6-a10b-3e098593bbd2'

        server = self.server.get_attached_cdrom(
            datacenter_id=datacenter_id,
            server_id=server_id,
            cdrom_id=cdrom_id)

        self.assertEqual(server['id'], cdrom_id)
        self.assertEqual(server['properties']['name'], 'Ubuntu 14.04')
        self.assertEqual(server['properties']['size'], 28)
        self.assertEqual(server['properties']['description'], 'Ubuntu image description')
        self.assertEqual(server['properties']['location'], 'de/fkb')
        self.assertEqual(server['properties']['imageType'], 'CDROM')
        self.assertEqual(server['properties']['licenceType'], 'UNKNOWN')
        self.assertFalse(server['properties']['public'])
        self.assertFalse(server['properties']['cpuHotPlug'])
        self.assertFalse(server['properties']['cpuHotUnplug'])
        self.assertFalse(server['properties']['ramHotPlug'])
        self.assertFalse(server['properties']['ramHotUnplug'])
        self.assertFalse(server['properties']['nicHotPlug'])
        self.assertFalse(server['properties']['nicHotUnplug'])
        self.assertFalse(server['properties']['discVirtioHotPlug'])
        self.assertFalse(server['properties']['discVirtioHotUnplug'])
        self.assertFalse(server['properties']['discScsiHotPlug'])
        self.assertFalse(server['properties']['discScsiHotUnplug'])

    def test_detach_cdrom(self):
        cdrom_id = '7df81087-5835-41c6-a10b-3e098593bbd2'

        server = self.server.detach_cdrom(
            datacenter_id=datacenter_id,
            server_id=server_id,
            cdrom_id=cdrom_id)

        self.assertTrue(server)

    def test_attach_cdrom(self):
        cdrom_id = '7df81087-5835-41c6-a10b-3e098593bbd2'

        server = self.server.attach_cdrom(
            datacenter_id=datacenter_id,
            server_id=server_id,
            cdrom_id=cdrom_id)

        self.assertEqual(server['id'], cdrom_id)
        self.assertEqual(server['properties']['name'], 'Ubuntu 14.04')
        self.assertEqual(server['properties']['size'], 28)
        self.assertEqual(server['properties']['description'], 'Ubuntu image description')
        self.assertEqual(server['properties']['location'], 'de/fkb')
        self.assertEqual(server['properties']['imageType'], 'CDROM')
        self.assertEqual(server['properties']['licenceType'], 'UNKNOWN')
        self.assertFalse(server['properties']['public'])
        self.assertFalse(server['properties']['cpuHotPlug'])
        self.assertFalse(server['properties']['cpuHotUnplug'])
        self.assertFalse(server['properties']['ramHotPlug'])
        self.assertFalse(server['properties']['ramHotUnplug'])
        self.assertFalse(server['properties']['nicHotPlug'])
        self.assertFalse(server['properties']['nicHotUnplug'])
        self.assertFalse(server['properties']['discVirtioHotPlug'])
        self.assertFalse(server['properties']['discVirtioHotUnplug'])
        self.assertFalse(server['properties']['discScsiHotPlug'])
        self.assertFalse(server['properties']['discScsiHotUnplug'])

    def test_start_server(self):
        server = self.server.start_server(
            datacenter_id=datacenter_id,
            server_id=server_id)

        self.assertTrue(server)

    def test_stop_server(self):
        server = self.server.stop_server(
            datacenter_id=datacenter_id,
            server_id=server_id)

        self.assertTrue(server)

    def test_reboot_server(self):
        server = self.server.reboot_server(
            datacenter_id=datacenter_id,
            server_id=server_id)

        self.assertTrue(server)
开发者ID:grandvizier,项目名称:profitbricks-sdk-python,代码行数:104,代码来源:test_server.py


注:本文中的profitbricks.client.ProfitBricksService.attach_cdrom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。