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


Python SolrSettings.init方法代码示例

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


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

示例1: test_entity_update_indexerror

# 需要导入模块: from ckan.lib.search.common import SolrSettings [as 别名]
# 或者: from ckan.lib.search.common.SolrSettings import init [as 别名]
    def test_entity_update_indexerror(self):
        """
        Test that we can't update a package if Solr is down.
        """
        bad_solr_url = "http://127.0.0.1/badsolrurl"
        original_settings = SolrSettings.get()[0]
        try:
            SolrSettings.init(bad_solr_url)

            assert_raises(search.SearchIndexError, self.assert_package_update_ok, "name", "post")
        finally:
            SolrSettings.init(original_settings)
开发者ID:rgrp,项目名称:ckan,代码行数:14,代码来源:test_package.py

示例2: test_entity_update_indexerror

# 需要导入模块: from ckan.lib.search.common import SolrSettings [as 别名]
# 或者: from ckan.lib.search.common.SolrSettings import init [as 别名]
    def test_entity_update_indexerror(self):
        """
        Test that we can't update a package if Solr is down.
        """
        bad_solr_url = 'http://example.com/badsolrurl'
        original_settings = SolrSettings.get()[0]
        try:
            SolrSettings.init(bad_solr_url)

            assert_raises(
                search.SearchIndexError, self.assert_package_update_ok, 'name', 'post'
            )
        finally:
            SolrSettings.init(original_settings)
开发者ID:DataShades,项目名称:ckan,代码行数:16,代码来源:test_package.py

示例3: test_entity_update_indexerror

# 需要导入模块: from ckan.lib.search.common import SolrSettings [as 别名]
# 或者: from ckan.lib.search.common.SolrSettings import init [as 别名]
    def test_entity_update_indexerror(self):
        """
        Test that we can't update a package if Solr is down.
        """
        bad_solr_url = 'http://127.0.0.1/badsolrurl'
        original_settings = SolrSettings.get()[0]
        try:
            SolrSettings.init(bad_solr_url)
            plugins.load('synchronous_search')

            assert_raises(
                search.SearchIndexError, self.assert_package_update_ok, 'name', 'post'
            )
        finally:
            plugins.unload('synchronous_search')
            SolrSettings.init(original_settings)
开发者ID:AdamJensen-dk,项目名称:ckan,代码行数:18,代码来源:test_package.py

示例4: test_register_post_indexerror

# 需要导入模块: from ckan.lib.search.common import SolrSettings [as 别名]
# 或者: from ckan.lib.search.common.SolrSettings import init [as 别名]
    def test_register_post_indexerror(self):
        """
        Test that we can't add a package if Solr is down.
        """
        bad_solr_url = 'http://example.com/badsolrurl'
        original_settings = SolrSettings.get()[0]
        try:
            SolrSettings.init(bad_solr_url)

            assert not self.get_package_by_name(self.package_fixture_data['name'])
            offset = self.package_offset()
            data = self.dumps(self.package_fixture_data)

            self.post_json(offset, data, status=500, extra_environ=self.admin_extra_environ)
            model.Session.remove()
        finally:
            SolrSettings.init(original_settings)
开发者ID:DataShades,项目名称:ckan,代码行数:19,代码来源:test_package.py

示例5: test_register_post_indexerror

# 需要导入模块: from ckan.lib.search.common import SolrSettings [as 别名]
# 或者: from ckan.lib.search.common.SolrSettings import init [as 别名]
    def test_register_post_indexerror(self):
        """
        Test that we can't add a package if Solr is down.
        """
        bad_solr_url = "http://127.0.0.1/badsolrurl"
        original_settings = SolrSettings.get()[0]
        try:
            SolrSettings.init(bad_solr_url)
            plugins.load("synchronous_search")

            assert not self.get_package_by_name(self.package_fixture_data["name"])
            offset = self.package_offset()
            data = self.dumps(self.package_fixture_data)

            self.post_json(offset, data, status=500, extra_environ=self.admin_extra_environ)
            model.Session.remove()
        finally:
            SolrSettings.init(original_settings)
开发者ID:beilharz,项目名称:ckan,代码行数:20,代码来源:test_package.py

示例6: test_new_indexerror

# 需要导入模块: from ckan.lib.search.common import SolrSettings [as 别名]
# 或者: from ckan.lib.search.common.SolrSettings import init [as 别名]
    def test_new_indexerror(self):
        bad_solr_url = 'http://127.0.0.1/badsolrurl'
        solr_url = SolrSettings.get()[0]
        try:
            SolrSettings.init(bad_solr_url)
            new_package_name = u'new-package-missing-solr'

            offset = url_for(controller='package', action='new')
            res = self.app.get(offset, extra_environ=self.extra_environ_tester)
            fv = res.forms['dataset-edit']
            fv['name'] = new_package_name

            # this package shouldn't actually be created but
            # add it to the list to purge just in case
            self.pkg_names.append(new_package_name)

            res = fv.submit('save', status=500, extra_environ=self.extra_environ_tester)
            assert 'Unable to add package to search index' in res, res
        finally:
            SolrSettings.init(solr_url)
开发者ID:HatemAlSum,项目名称:ckan,代码行数:22,代码来源:test_package.py


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