本文整理汇总了Python中azure.storage.queue.QueueService.update_message方法的典型用法代码示例。如果您正苦于以下问题:Python QueueService.update_message方法的具体用法?Python QueueService.update_message怎么用?Python QueueService.update_message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类azure.storage.queue.QueueService
的用法示例。
在下文中一共展示了QueueService.update_message方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_sas_update
# 需要导入模块: from azure.storage.queue import QueueService [as 别名]
# 或者: from azure.storage.queue.QueueService import update_message [as 别名]
def test_sas_update(self):
# SAS URL is calculated from storage key, so this test runs live only
if TestMode.need_recordingfile(self.test_mode):
return
# Arrange
self.qs.put_message(self.test_queues[0], 'message1')
token = self.qs.generate_shared_access_signature(
self.test_queues[0],
self._get_shared_access_policy(QueueSharedAccessPermissions.UPDATE),
)
result = self.qs.get_messages(self.test_queues[0])
# Act
service = QueueService(
account_name=self.settings.STORAGE_ACCOUNT_NAME,
sas_token=token,
)
self._set_service_options(service, self.settings)
service.update_message(
self.test_queues[0],
result[0].message_id,
'updatedmessage1',
result[0].pop_receipt,
visibilitytimeout=0,
)
# Assert
result = self.qs.get_messages(self.test_queues[0])
self.assertEqual('updatedmessage1', result[0].message_text)
示例2: test_sas_update
# 需要导入模块: from azure.storage.queue import QueueService [as 别名]
# 或者: from azure.storage.queue.QueueService import update_message [as 别名]
def test_sas_update(self):
# SAS URL is calculated from storage key, so this test runs live only
if TestMode.need_recording_file(self.test_mode):
return
# Arrange
queue_name = self._create_queue()
self.qs.put_message(queue_name, u'message1')
token = self.qs.generate_queue_shared_access_signature(
queue_name,
QueuePermissions.UPDATE,
datetime.utcnow() + timedelta(hours=1),
)
result = self.qs.get_messages(queue_name)
# Act
service = QueueService(
account_name=self.settings.STORAGE_ACCOUNT_NAME,
sas_token=token,
)
self._set_service_options(service, self.settings)
service.update_message(
queue_name,
result[0].id,
result[0].pop_receipt,
visibility_timeout=0,
content=u'updatedmessage1',
)
# Assert
result = self.qs.get_messages(queue_name)
self.assertEqual(u'updatedmessage1', result[0].content)