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