當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。