本文整理汇总了Python中tastypie.bundle.Bundle.data['object_id']方法的典型用法代码示例。如果您正苦于以下问题:Python Bundle.data['object_id']方法的具体用法?Python Bundle.data['object_id']怎么用?Python Bundle.data['object_id']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tastypie.bundle.Bundle
的用法示例。
在下文中一共展示了Bundle.data['object_id']方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_vocabulary_validation
# 需要导入模块: from tastypie.bundle import Bundle [as 别名]
# 或者: from tastypie.bundle.Bundle import data['object_id'] [as 别名]
def test_vocabulary_validation(self):
vv = VocabularyValidation()
request = RequestFactory()
request.course = self.sample_course
mock_bundle = Bundle()
mock_bundle.data['display_name'] = 'Shapes'
mock_bundle.request = request
errors = vv.is_valid(mock_bundle)
self.assertTrue('error_message' in errors)
self.assertTrue(
'A Shapes concept exists' in errors['error_message'][0])
mock_bundle = Bundle()
mock_bundle.data['display_name'] = 'Patterns'
mock_bundle.data['object_id'] = self.sample_course.id
mock_bundle.request = request
errors = vv.is_valid(mock_bundle)
self.assertFalse('error_message' in errors)