本文整理汇总了Python中pyos.utils.random_unicode函数的典型用法代码示例。如果您正苦于以下问题:Python random_unicode函数的具体用法?Python random_unicode怎么用?Python random_unicode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了random_unicode函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_imgmgr_create_body
def test_imgmgr_create_body(self):
clt = self.client
mgr = clt._manager
nm = utils.random_unicode()
meta = utils.random_unicode()
body = mgr._create_body(nm, metadata=meta)
self.assertEqual(body, {"metadata": meta})
开发者ID:emonty,项目名称:pyos,代码行数:7,代码来源:test_image.py
示例2: test_img_update
def test_img_update(self):
img = self.image
key = utils.random_unicode()
val = utils.random_unicode()
img.manager.update = Mock()
img.update({key: val})
img.manager.update.assert_called_once_with(img, {key: val})
开发者ID:emonty,项目名称:pyos,代码行数:7,代码来源:test_image.py
示例3: test_claim
def test_claim(self):
msgs = []
num = random.randint(1, 9)
for ii in range(num):
msg_id = utils.random_unicode()
claim_id = utils.random_unicode()
age = utils.random_unicode()
body = utils.random_unicode()
ttl = utils.random_unicode()
href = "http://example.com/%s" % msg_id
info = {"href": href,
"age": age,
"body": body,
"ttl": ttl,
}
msgs.append(info)
id_ = _safe_id()
href = "http://example.com/%s" % id_
info = {"href": href,
"messages": msgs,
}
mgr = fakes.FakeQueueManager()
mgr._message_manager = fakes.FakeQueueManager()
clm = QueueClaim(manager=mgr, info=info)
self.assertEqual(clm.id, id_)
self.assertEqual(len(clm.messages), num)
开发者ID:emonty,项目名称:pyos,代码行数:26,代码来源:test_queues.py
示例4: test_queue_post_message
def test_queue_post_message(self):
q = self.queue
q._message_manager.create = Mock()
body = utils.random_unicode()
ttl = utils.random_unicode()
q.post_message(body, ttl)
q._message_manager.create.assert_called_once_with(body, ttl)
开发者ID:emonty,项目名称:pyos,代码行数:7,代码来源:test_queues.py
示例5: test_create_body_volume
def test_create_body_volume(self):
mgr = self.client._manager
size = random.randint(MIN_SIZE, MAX_SIZE)
name = utils.random_unicode()
snapshot_id = utils.random_unicode()
clone_id = utils.random_unicode()
display_description = None
volume_type = None
metadata = None
availability_zone = utils.random_unicode()
fake_body = {"volume": {
"size": size,
"snapshot_id": snapshot_id,
"source_volid": clone_id,
"display_name": name,
"display_description": "",
"volume_type": "SATA",
"metadata": {},
"availability_zone": availability_zone,
}}
ret = mgr._create_body(name=name, size=size, volume_type=volume_type,
description=display_description, metadata=metadata,
snapshot_id=snapshot_id, clone_id=clone_id,
availability_zone=availability_zone)
self.assertEqual(ret, fake_body)
开发者ID:emonty,项目名称:pyos,代码行数:25,代码来源:test_cloud_blockstorage.py
示例6: test_queue_mgr_create_body
def test_queue_mgr_create_body(self):
clt = self.client
mgr = clt._manager
name = utils.random_unicode()
metadata = utils.random_unicode()
ret = mgr._create_body(name, metadata=metadata)
self.assertEqual(ret, {"metadata": metadata})
开发者ID:emonty,项目名称:pyos,代码行数:7,代码来源:test_queues.py
示例7: test_findall
def test_findall(self):
mgr = self.client._manager
mgr.findall = Mock()
prop = utils.random_unicode()
val = utils.random_unicode()
self.client.findall(prop=val)
mgr.findall.assert_called_once_with(prop=val)
开发者ID:emonty,项目名称:pyos,代码行数:7,代码来源:test_client.py
示例8: test_img_member_mgr_create_body
def test_img_member_mgr_create_body(self):
img = self.image
mgr = img._member_manager
nm = utils.random_unicode()
project_id = utils.random_unicode()
ret = mgr._create_body(nm, project_id)
self.assertEqual(ret, {"member": project_id})
开发者ID:emonty,项目名称:pyos,代码行数:7,代码来源:test_image.py
示例9: test_queue_id_property
def test_queue_id_property(self):
q = self.queue
val = utils.random_unicode()
q.name = val
self.assertEqual(q.id, val)
val = utils.random_unicode()
q.id = val
self.assertEqual(q.name, val)
开发者ID:emonty,项目名称:pyos,代码行数:8,代码来源:test_queues.py
示例10: test_list_users
def test_list_users(self):
inst = self.instance
inst._user_manager.list = Mock()
limit = utils.random_unicode()
marker = utils.random_unicode()
inst.list_users(limit=limit, marker=marker)
inst._user_manager.list.assert_called_once_with(limit=limit,
marker=marker)
开发者ID:emonty,项目名称:pyos,代码行数:8,代码来源:test_cloud_databases.py
示例11: test_queue_claim_messages
def test_queue_claim_messages(self):
q = self.queue
q._claim_manager.claim = Mock()
ttl = utils.random_unicode()
grace = utils.random_unicode()
count = random.randint(1, 9)
q.claim_messages(ttl, grace, count=count)
q._claim_manager.claim.assert_called_once_with(ttl, grace, count=count)
开发者ID:emonty,项目名称:pyos,代码行数:8,代码来源:test_queues.py
示例12: test_queue_delete_message
def test_queue_delete_message(self):
q = self.queue
q._message_manager.delete = Mock()
msg_id = utils.random_unicode()
claim_id = utils.random_unicode()
q.delete_message(msg_id, claim_id=claim_id)
q._message_manager.delete.assert_called_once_with(msg_id,
claim_id=claim_id)
开发者ID:emonty,项目名称:pyos,代码行数:8,代码来源:test_queues.py
示例13: __init__
def __init__(self, *args, **kwargs):
info = kwargs.pop("info", {"fake": "fake"})
info["name"] = utils.random_unicode()
info["id"] = utils.random_unicode()
mgr = kwargs.pop("manager", FakeImageManager())
kwargs["member_manager_class"] = FakeImageMemberManager
kwargs["tag_manager_class"] = FakeImageTagManager
super(FakeImage, self).__init__(mgr, info, *args, **kwargs)
开发者ID:emonty,项目名称:pyos,代码行数:8,代码来源:fakes.py
示例14: test_volume_description_property
def test_volume_description_property(self):
vol = self.volume
nm = utils.random_unicode()
vol.display_description = nm
self.assertEqual(vol.description, vol.display_description)
nm = utils.random_unicode()
vol.description = nm
self.assertEqual(vol.description, vol.display_description)
开发者ID:emonty,项目名称:pyos,代码行数:8,代码来源:test_cloud_blockstorage.py
示例15: test_volume_name_property
def test_volume_name_property(self):
vol = self.volume
nm = utils.random_unicode()
vol.display_name = nm
self.assertEqual(vol.name, vol.display_name)
nm = utils.random_unicode()
vol.name = nm
self.assertEqual(vol.name, vol.display_name)
开发者ID:emonty,项目名称:pyos,代码行数:8,代码来源:test_cloud_blockstorage.py
示例16: test_create_snapshot
def test_create_snapshot(self):
vol = self.volume
vol.manager.create_snapshot = Mock()
name = utils.random_unicode()
desc = utils.random_unicode()
vol.create_snapshot(name=name, description=desc, force=False)
vol.manager.create_snapshot.assert_called_once_with(volume=vol,
name=name, description=desc, force=False)
开发者ID:emonty,项目名称:pyos,代码行数:8,代码来源:test_cloud_blockstorage.py
示例17: test_detach_from_instance_fail
def test_detach_from_instance_fail(self):
vol = self.volume
srv_id = utils.random_unicode()
att_id = utils.random_unicode()
vol.attachments = [{"server_id": srv_id, "id": att_id}]
vol._nova_volumes.delete_server_volume = Mock(
side_effect=Exception("test"))
self.assertRaises(exc.VolumeDetachmentFailed, vol.detach)
开发者ID:emonty,项目名称:pyos,代码行数:8,代码来源:test_cloud_blockstorage.py
示例18: test_snapshot_description_property
def test_snapshot_description_property(self):
snap = self.snapshot
nm = utils.random_unicode()
snap.display_description = nm
self.assertEqual(snap.description, snap.display_description)
nm = utils.random_unicode()
snap.description = nm
self.assertEqual(snap.description, snap.display_description)
开发者ID:emonty,项目名称:pyos,代码行数:8,代码来源:test_cloud_blockstorage.py
示例19: test_snapshot_name_property
def test_snapshot_name_property(self):
snap = self.snapshot
nm = utils.random_unicode()
snap.display_name = nm
self.assertEqual(snap.name, snap.display_name)
nm = utils.random_unicode()
snap.name = nm
self.assertEqual(snap.name, snap.display_name)
开发者ID:emonty,项目名称:pyos,代码行数:8,代码来源:test_cloud_blockstorage.py
示例20: test_list_flavors
def test_list_flavors(self):
clt = self.client
clt._flavor_manager.list = Mock()
limit = utils.random_unicode()
marker = utils.random_unicode()
clt.list_flavors(limit=limit, marker=marker)
clt._flavor_manager.list.assert_called_once_with(limit=limit,
marker=marker)
开发者ID:emonty,项目名称:pyos,代码行数:8,代码来源:test_cloud_databases.py
注:本文中的pyos.utils.random_unicode函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论