当前位置: 首页>>代码示例>>Python>>正文


Python DesignDocument.keys方法代码示例

本文整理汇总了Python中cloudant.design_document.DesignDocument.keys方法的典型用法代码示例。如果您正苦于以下问题:Python DesignDocument.keys方法的具体用法?Python DesignDocument.keys怎么用?Python DesignDocument.keys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cloudant.design_document.DesignDocument的用法示例。


在下文中一共展示了DesignDocument.keys方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_fetch_no_views

# 需要导入模块: from cloudant.design_document import DesignDocument [as 别名]
# 或者: from cloudant.design_document.DesignDocument import keys [as 别名]
 def test_fetch_no_views(self):
     """
     Ensure that the document fetched from the database returns the
     DesignDocument format as expected when retrieving a design document
     containing no views.
     """
     ddoc = DesignDocument(self.db, "_design/ddoc001")
     ddoc.save()
     ddoc_remote = DesignDocument(self.db, "_design/ddoc001")
     ddoc_remote.fetch()
     self.assertEqual(set(ddoc_remote.keys()), {"_id", "_rev", "views"})
     self.assertEqual(ddoc_remote["_id"], "_design/ddoc001")
     self.assertTrue(ddoc_remote["_rev"].startswith("1-"))
     self.assertEqual(ddoc_remote["_rev"], ddoc["_rev"])
     self.assertEqual(ddoc_remote.views, {})
开发者ID:rredburn,项目名称:python-cloudant,代码行数:17,代码来源:design_document_tests.py

示例2: test_fetch_no_views

# 需要导入模块: from cloudant.design_document import DesignDocument [as 别名]
# 或者: from cloudant.design_document.DesignDocument import keys [as 别名]
 def test_fetch_no_views(self):
     """
     Ensure that the document fetched from the database returns the
     DesignDocument format as expected when retrieving a design document
     containing no views.
     """
     ddoc = DesignDocument(self.db, '_design/ddoc001')
     ddoc.save()
     ddoc_remote = DesignDocument(self.db, '_design/ddoc001')
     ddoc_remote.fetch()
     self.assertEqual(set(ddoc_remote.keys()),
                      {'_id', '_rev', 'indexes', 'views'})
     self.assertEqual(ddoc_remote['_id'], '_design/ddoc001')
     self.assertTrue(ddoc_remote['_rev'].startswith('1-'))
     self.assertEqual(ddoc_remote['_rev'], ddoc['_rev'])
     self.assertEqual(ddoc_remote.views, {})
开发者ID:drarvindsathi,项目名称:python-cloudant,代码行数:18,代码来源:design_document_tests.py

示例3: test_fetch_no_search_index

# 需要导入模块: from cloudant.design_document import DesignDocument [as 别名]
# 或者: from cloudant.design_document.DesignDocument import keys [as 别名]
 def test_fetch_no_search_index(self):
     """
     Ensure that the document fetched from the database returns the
     DesignDocument format as expected when retrieving a design document
     containing no search indexes.
     The :func:`~cloudant.design_document.DesignDocument.fetch` function
     adds the ``indexes`` key in the locally cached DesignDocument if
     indexes do not exist in the remote design document.
     """
     ddoc = DesignDocument(self.db, '_design/ddoc001')
     ddoc.save()
     ddoc_remote = DesignDocument(self.db, '_design/ddoc001')
     ddoc_remote.fetch()
     self.assertEqual(set(ddoc_remote.keys()),
                      {'_id', '_rev', 'indexes', 'views'})
     self.assertEqual(ddoc_remote['_id'], '_design/ddoc001')
     self.assertTrue(ddoc_remote['_rev'].startswith('1-'))
     self.assertEqual(ddoc_remote['_rev'], ddoc['_rev'])
     self.assertEqual(ddoc_remote.indexes, {})
开发者ID:drarvindsathi,项目名称:python-cloudant,代码行数:21,代码来源:design_document_tests.py

示例4: test_save_with_no_search_indexes

# 需要导入模块: from cloudant.design_document import DesignDocument [as 别名]
# 或者: from cloudant.design_document.DesignDocument import keys [as 别名]
 def test_save_with_no_search_indexes(self):
     """
     Tests the functionality when saving a design document without a search
     index. Both the locally cached and remote DesignDocument should not
     include the empty indexes sub-document.
     """
     ddoc = DesignDocument(self.db, '_design/ddoc001')
     ddoc.save()
     # Ensure that locally cached DesignDocument contains an
     # empty search indexes and views dict.
     self.assertEqual(set(ddoc.keys()), {'_id', '_rev', 'indexes', 'views'})
     self.assertEqual(ddoc['_id'], '_design/ddoc001')
     self.assertTrue(ddoc['_rev'].startswith('1-'))
     # Ensure that remotely saved design document does not
     # include a search indexes sub-document.
     resp = self.client.r_session.get(ddoc.document_url)
     raw_ddoc = resp.json()
     self.assertEqual(set(raw_ddoc.keys()), {'_id', '_rev'})
     self.assertEqual(raw_ddoc['_id'], ddoc['_id'])
     self.assertEqual(raw_ddoc['_rev'], ddoc['_rev'])
开发者ID:drarvindsathi,项目名称:python-cloudant,代码行数:22,代码来源:design_document_tests.py

示例5: test_save_with_no_views

# 需要导入模块: from cloudant.design_document import DesignDocument [as 别名]
# 或者: from cloudant.design_document.DesignDocument import keys [as 别名]
 def test_save_with_no_views(self):
     """
     Tests the functionality when saving a design document without a view.
     The locally cached DesignDocument should contain an empty views dict
     while the design document saved remotely should not include the empty
     views sub-document.
     """
     ddoc = DesignDocument(self.db, "_design/ddoc001")
     ddoc.save()
     # Ensure that locally cached DesignDocument contains an
     # empty views dict.
     self.assertEqual(set(ddoc.keys()), {"_id", "_rev", "views"})
     self.assertEqual(ddoc["_id"], "_design/ddoc001")
     self.assertTrue(ddoc["_rev"].startswith("1-"))
     self.assertEqual(ddoc.views, {})
     # Ensure that remotely saved design document does not
     # include a views sub-document.
     resp = self.client.r_session.get(ddoc.document_url)
     raw_ddoc = resp.json()
     self.assertEqual(set(raw_ddoc.keys()), {"_id", "_rev"})
     self.assertEqual(raw_ddoc["_id"], ddoc["_id"])
     self.assertEqual(raw_ddoc["_rev"], ddoc["_rev"])
开发者ID:rredburn,项目名称:python-cloudant,代码行数:24,代码来源:design_document_tests.py


注:本文中的cloudant.design_document.DesignDocument.keys方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。