本文整理汇总了Python中lunr.api.controller.volume.VolumeController.show方法的典型用法代码示例。如果您正苦于以下问题:Python VolumeController.show方法的具体用法?Python VolumeController.show怎么用?Python VolumeController.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lunr.api.controller.volume.VolumeController
的用法示例。
在下文中一共展示了VolumeController.show方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_show
# 需要导入模块: from lunr.api.controller.volume import VolumeController [as 别名]
# 或者: from lunr.api.controller.volume.VolumeController import show [as 别名]
def test_show(self):
c = Controller({'account_id': self.account_id, 'id': 'test'},
self.mock_app)
req = Request.blank('?size=1&volume_type_name=vtype')
c.create(req)
req = Request.blank('')
res = c.show(req)
self.assertEqual(res.body['id'], 'test')
c = Controller(
{
'account_id': self.account_id,
'id': '00000000-0000-0000-0000-000000000000',
}, self.mock_app)
req = Request.blank('')
self.assertRaises(HTTPNotFound, c.show, req)
示例2: test_show_fails_after_account_is_deleted
# 需要导入模块: from lunr.api.controller.volume import VolumeController [as 别名]
# 或者: from lunr.api.controller.volume.VolumeController import show [as 别名]
def test_show_fails_after_account_is_deleted(self):
# create volume
c = Controller({'account_id': self.account_id, 'id': 'test'},
self.mock_app)
req = Request.blank('?size=1&volume_type_name=vtype')
c.create(req)
# delete account
self.account.status = 'DELETED'
self.db.add(self.account)
self.db.commit()
# should raise not found
c = Controller({'account_id': self.account_id, 'id': 'test'},
self.mock_app)
req = Request.blank('')
self.assertRaises(HTTPNotFound, c.show, req)
# admin still works
c = Controller({'account_id': 'admin', 'id': 'test'},
self.mock_app)
req = Request.blank('')
res = c.show(req)
self.assertEqual(res.body['id'], 'test')