本文整理汇总了Python中utils.assert_isinstance函数的典型用法代码示例。如果您正苦于以下问题:Python assert_isinstance函数的具体用法?Python assert_isinstance怎么用?Python assert_isinstance使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assert_isinstance函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_create_load_balancer
def test_create_load_balancer():
lb = cs.load_balancers.create(
name="my-lb",
protocol="HTTP",
nodes=[{"address": "10.0.0.1", "protocol": "HTTP", "condition": NodeCondition.ENABLED}],
virtual_ips=[{"type": VirtualIPType.PUBLIC}],
)
cs.assert_called("POST", "/loadbalancers")
assert_isinstance(lb, LoadBalancer)
开发者ID:kuhnza,项目名称:openstack.compute,代码行数:9,代码来源:test_load_balancers.py
示例2: test_create_server
def test_create_server():
s = cs.servers.create(
name = "My server",
image = 1,
flavor = 1,
meta = {'foo': 'bar'},
ipgroup = 1,
files = {
'/etc/passwd': 'some data', # a file
'/tmp/foo.txt': StringIO.StringIO('data') # a stream
}
)
cs.assert_called('POST', '/servers')
assert_isinstance(s, Server)
开发者ID:rlr,项目名称:openstack.compute,代码行数:14,代码来源:test_servers.py
示例3: test_get_backup_schedule
def test_get_backup_schedule():
s = cs.servers.get(1234)
# access via manager
b = cs.backup_schedules.get(server=s)
assert_isinstance(b, BackupSchedule)
cs.assert_called('GET', '/servers/1234/backup_schedule')
b = cs.backup_schedules.get(server=1234)
assert_isinstance(b, BackupSchedule)
cs.assert_called('GET', '/servers/1234/backup_schedule')
# access via instance
assert_isinstance(s.backup_schedule, BackupSchedule)
cs.assert_called('GET', '/servers/1234/backup_schedule')
# Just for coverage's sake
b = s.backup_schedule.get()
cs.assert_called('GET', '/servers/1234/backup_schedule')
开发者ID:wendy-king,项目名称:x7_venv,代码行数:19,代码来源:test_backup_schedules.py
示例4: test_get_server_details
def test_get_server_details():
s = cs.servers.get(1234)
cs.assert_called('GET', '/servers/1234')
assert_isinstance(s, Server)
assert_equal(s.id, 1234)
assert_equal(s.status, 'BUILD')
开发者ID:rlr,项目名称:openstack.compute,代码行数:6,代码来源:test_servers.py
示例5: test_get_image_details
def test_get_image_details():
i = cs.images.get(1)
cs.assert_called("GET", "/images/1")
assert_isinstance(i, Image)
assert_equal(i.id, 1)
assert_equal(i.name, "CentOS 5.2")
开发者ID:wendy-king,项目名称:x7_venv,代码行数:6,代码来源:test_images.py
示例6: test_list_flavors
def test_list_flavors():
fl = cs.flavors.list()
cs.assert_called('GET', '/flavors/detail')
[assert_isinstance(f, Flavor) for f in fl]
开发者ID:EdLeafe,项目名称:python-novaclient,代码行数:4,代码来源:test_flavors.py
示例7: test_list_servers_undetailed
def test_list_servers_undetailed():
sl = cs.servers.list(detailed=False)
cs.assert_called('GET', '/servers')
[assert_isinstance(s, Server) for s in sl]
开发者ID:Reldan,项目名称:python-novaclient,代码行数:4,代码来源:test_servers.py
示例8: test_create_image
def test_create_image():
i = cs.images.create(server=1234, name="Just in case")
cs.assert_called('POST', '/images')
assert_isinstance(i, Image)
开发者ID:calebgroom,项目名称:python-cloudservers,代码行数:4,代码来源:test_images.py
示例9: test_list_flavors_undetailed
def test_list_flavors_undetailed():
fl = cs.flavors.list(detailed=False)
cs.assert_called('GET', '/flavors')
[assert_isinstance(f, Flavor) for f in fl]
开发者ID:EdLeafe,项目名称:python-novaclient,代码行数:4,代码来源:test_flavors.py
示例10: test_get_zone_details
def test_get_zone_details():
s = os.zones.get(1)
os.assert_called('GET', '/zones/1')
assert_isinstance(s, Zone)
assert_equal(s.id, 1)
assert_equal(s.api_url, 'http://foo.com')
开发者ID:EdLeafe,项目名称:python-novaclient,代码行数:6,代码来源:test_zones.py
示例11: test_list_zones
def test_list_zones():
sl = os.zones.list()
os.assert_called('GET', '/zones/detail')
[assert_isinstance(s, Zone) for s in sl]
开发者ID:EdLeafe,项目名称:python-novaclient,代码行数:4,代码来源:test_zones.py
示例12: test_list_load_balancers
def test_list_load_balancers():
lbs = cs.load_balancers.list()
cs.assert_called("GET", "/loadbalancers")
[assert_isinstance(lb, LoadBalancer) for lb in lbs]
开发者ID:kuhnza,项目名称:openstack.compute,代码行数:4,代码来源:test_load_balancers.py
示例13: test_list_servers
def test_list_servers():
sl = cs.servers.list()
cs.assert_called('GET', '/servers/detail')
[assert_isinstance(s, Server) for s in sl]
开发者ID:rlr,项目名称:openstack.compute,代码行数:4,代码来源:test_servers.py
示例14: test_load_balancer_node_details
def test_load_balancer_node_details():
lb = cs.load_balancers.get(71)
node = lb.nodes.get(410)
cs.assert_called("GET", "/loadbalancers/71/nodes/410")
assert_isinstance(node, Node)
assert_equal(node.id, 410)
开发者ID:kuhnza,项目名称:openstack.compute,代码行数:6,代码来源:test_load_balancers.py
示例15: test_load_balancer_list_nodes
def test_load_balancer_list_nodes():
lb = cs.load_balancers.get(71)
nodes = lb.nodes.list()
cs.assert_called("GET", "/loadbalancers/71/nodes")
[assert_isinstance(node, Node) for node in nodes]
开发者ID:kuhnza,项目名称:openstack.compute,代码行数:5,代码来源:test_load_balancers.py
示例16: test_load_balancer_add_virtual_ip
def test_load_balancer_add_virtual_ip():
lb = cs.load_balancers.get(71)
virtual_ip = lb.virtual_ips.add(type="PUBLIC", ip_version="IPV6")
cs.assert_called("POST", "/loadbalancers/71/virtualips")
assert_isinstance(virtual_ip, VirtualIP)
开发者ID:kuhnza,项目名称:openstack.compute,代码行数:5,代码来源:test_load_balancers.py
示例17: test_load_balancer_list_virtual_ips
def test_load_balancer_list_virtual_ips():
lb = cs.load_balancers.get(71)
virtual_ips = lb.virtual_ips.list()
cs.assert_called("GET", "/loadbalancers/71/virtualips")
[assert_isinstance(virtual_ip, VirtualIP) for virtual_ip in virtual_ips]
开发者ID:kuhnza,项目名称:openstack.compute,代码行数:5,代码来源:test_load_balancers.py
示例18: test_get_load_balancer_details
def test_get_load_balancer_details():
lb = cs.load_balancers.get(71)
cs.assert_called("GET", "/loadbalancers/71")
assert_isinstance(lb, LoadBalancer)
assert_equal(lb.id, 71)
assert_equal(lb.status, "ACTIVE")
开发者ID:kuhnza,项目名称:openstack.compute,代码行数:6,代码来源:test_load_balancers.py
示例19: test_list_zones_undetailed
def test_list_zones_undetailed():
sl = os.zones.list(detailed=False)
os.assert_called('GET', '/zones')
[assert_isinstance(s, Zone) for s in sl]
开发者ID:EdLeafe,项目名称:python-novaclient,代码行数:4,代码来源:test_zones.py
示例20: test_list_images
def test_list_images():
il = cs.images.list()
cs.assert_called("GET", "/images/detail")
[assert_isinstance(i, Image) for i in il]
开发者ID:wendy-king,项目名称:x7_venv,代码行数:4,代码来源:test_images.py
注:本文中的utils.assert_isinstance函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论