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


Python Host.getOS方法代码示例

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


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

示例1: test_host_serialization

# 需要导入模块: from model.hosts import Host [as 别名]
# 或者: from model.hosts.Host import getOS [as 别名]
 def test_host_serialization(self):
     host = Host(name="pepito", os="linux")
     host.setDescription("Some description")
     host.setOwned(True)
     hserialized = self.hmapper.serialize(host)
     # if serialization fails, returns None
     self.assertNotEqual(
         hserialized,
         None,
         "Serialized host shouldn't be None")
     # we check the host attributes
     self.assertEquals(
         hserialized.get("_id"),
         host.getID(),
         "Serialized ID is not the same as Host ID")
     self.assertEquals(
         hserialized.get("name"),
         host.getName(),
         "Serialized name is not the same as Host name")
     self.assertEquals(
         hserialized.get("os"),
         host.getOS(),
         "Serialized OS is not the same as Host OS")
     self.assertEquals(
         hserialized.get("description"),
         host.getDescription(),
         "Serialized description is not the same as Host description")
     self.assertEquals(
         hserialized.get("owned"),
         host.isOwned(),
         "Serialized owned flag is not the same as Host owned flag")
开发者ID:BwRy,项目名称:faraday,代码行数:33,代码来源:mapper.py

示例2: testEditHostSyncGetsMapperDispatchedSYNC

# 需要导入模块: from model.hosts import Host [as 别名]
# 或者: from model.hosts.Host import getOS [as 别名]
    def testEditHostSyncGetsMapperDispatchedSYNC(self):
        host = Host("coquito")

        mappersManager = self.createMapperMock()
        objectMapper = mock()
        triemock = mock()
        when(mappersManager).find(host.getID()).thenReturn(host)
        when(mappersManager).saveObject(host).thenReturn(True)

        model_controller = controller.ModelController(mock(), mappersManager) 

        model_controller.editHostSYNC(host.getID(), 'new_name', 'new_desc', 'new_os', True)

        verify(mappersManager).saveObject(host) 
        verify(mappersManager).find(host.getID())

        self.assertEquals(host.getName(), 'new_name', "Name not updated")
        self.assertEquals(host.getDescription(), 'new_desc', "Description not updated")
        self.assertEquals(host.getOS(), 'new_os', "OS not updated")
        self.assertEquals(host.isOwned(), True, "Owned status not updated")
开发者ID:BwRy,项目名称:faraday,代码行数:22,代码来源:model_controller.py


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