本文整理汇总了Python中utils.assert_isinstance函数的典型用法代码示例。如果您正苦于以下问题:Python assert_isinstance函数的具体用法?Python assert_isinstance怎么用?Python assert_isinstance使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assert_isinstance函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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)
示例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')
示例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')
示例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")
示例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]
示例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]
示例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)
示例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]
示例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')
示例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]
示例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]
示例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]
示例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)
示例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]