本文整理汇总了Python中cloudant.design_document.DesignDocument.list_views方法的典型用法代码示例。如果您正苦于以下问题:Python DesignDocument.list_views方法的具体用法?Python DesignDocument.list_views怎么用?Python DesignDocument.list_views使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cloudant.design_document.DesignDocument
的用法示例。
在下文中一共展示了DesignDocument.list_views方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_list_views
# 需要导入模块: from cloudant.design_document import DesignDocument [as 别名]
# 或者: from cloudant.design_document.DesignDocument import list_views [as 别名]
def test_list_views(self):
mock_database = mock.Mock()
ddoc = DesignDocument(mock_database, '_design/unittest')
ddoc['views'] = {
'view1': {'map': "MAP", 'reduce': 'REDUCE'},
'view2': {'map': "MAP", 'reduce': 'REDUCE'},
}
self.assertListEqual(sorted(ddoc.list_views()), ['view1', 'view2'])
示例2: test_list_views
# 需要导入模块: from cloudant.design_document import DesignDocument [as 别名]
# 或者: from cloudant.design_document.DesignDocument import list_views [as 别名]
def test_list_views(self):
"""
Test the retrieval of view name list from DesignDocument
"""
ddoc = DesignDocument(self.db, "_design/ddoc001")
view_map = "function (doc) {\n emit(doc._id, 1);\n}"
ddoc.add_view("view001", view_map)
ddoc.add_view("view002", view_map)
ddoc.add_view("view003", view_map)
self.assertTrue(all(x in ddoc.list_views() for x in ["view001", "view002", "view003"]))
示例3: test_list_views
# 需要导入模块: from cloudant.design_document import DesignDocument [as 别名]
# 或者: from cloudant.design_document.DesignDocument import list_views [as 别名]
def test_list_views(self):
"""
Test the retrieval of view name list from DesignDocument
"""
ddoc = DesignDocument(self.db, '_design/ddoc001')
view_map = 'function (doc) {\n emit(doc._id, 1);\n}'
ddoc.add_view('view001', view_map)
ddoc.add_view('view002', view_map)
ddoc.add_view('view003', view_map)
self.assertTrue(
all(x in ddoc.list_views() for x in [
'view001',
'view002',
'view003'
])
)