本文整理汇总了Python中flashcardapp.datacontroller.DataController.getLabelList方法的典型用法代码示例。如果您正苦于以下问题:Python DataController.getLabelList方法的具体用法?Python DataController.getLabelList怎么用?Python DataController.getLabelList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flashcardapp.datacontroller.DataController
的用法示例。
在下文中一共展示了DataController.getLabelList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getLabelList
# 需要导入模块: from flashcardapp.datacontroller import DataController [as 别名]
# 或者: from flashcardapp.datacontroller.DataController import getLabelList [as 别名]
def getLabelList(request):
''' Ajax wrapper for the DataController function 'getLabelList'
*Takes*
The Id of the container to put this box in.
*Returns*
A json string declaring saved data success or failure
See the DataController documentation for more information
'''
dc = DataController()
return dc.getLabelList(request.user)
示例2: test_getLabelList
# 需要导入模块: from flashcardapp.datacontroller import DataController [as 别名]
# 或者: from flashcardapp.datacontroller.DataController import getLabelList [as 别名]
def test_getLabelList(self):
"""
Docstring goes here
"""
#First, test an actual user with extra labels
numoflabels = 13
dc = DataController()
jsonStr = dc.getLabelList(self.user)
data = json.loads(jsonStr)
self.assertTrue(data != None)
self.assertEqual(data['message'], DataController.SUCCESS_STR)
labels = data['list']
self.assertIsNotNone(labels)
self.assertEqual(len(labels), numoflabels)
#Now test a no user case. Should get back the default labels
numoflabels = 12
data = json.loads(dc.getLabelList(None))
self.assertIsNotNone(data)
self.assertEqual(data['message'], DataController.SUCCESS_STR)
labels = data['list']
self.assertIsNotNone(labels)
self.assertEqual(len(labels), numoflabels)