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


Python Env.search_url_config方法代码示例

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


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

示例1: test_common_args_parsing

# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import search_url_config [as 别名]
    def test_common_args_parsing(self):
        excluded_indexes = 'myapp.indexes.A,myapp.indexes.B'
        include_spelling = 1
        batch_size = 100
        params = 'EXCLUDED_INDEXES=%s&INCLUDE_SPELLING=%s&BATCH_SIZE=%s' % (
            excluded_indexes,
            include_spelling,
            batch_size
        )
        for url in [
            self.solr_url,
            self.elasticsearch_url,
            self.whoosh_url,
            self.xapian_url,
            self.simple_url,
        ]:
            url = '?'.join([url, params])
            url = Env.search_url_config(url)

            self.assertTrue('EXCLUDED_INDEXES' in url.keys())
            self.assertTrue('myapp.indexes.A' in url['EXCLUDED_INDEXES'])
            self.assertTrue('myapp.indexes.B' in url['EXCLUDED_INDEXES'])
            self.assertTrue('INCLUDE_SPELLING'in url.keys())
            self.assertTrue(url['INCLUDE_SPELLING'])
            self.assertTrue('BATCH_SIZE' in url.keys())
            self.assertEqual(url['BATCH_SIZE'], 100)
开发者ID:AliLozano,项目名称:django-environ,代码行数:28,代码来源:test.py

示例2: test_xapian_parsing

# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import search_url_config [as 别名]
    def test_xapian_parsing(self):
        flags = 'myflags'
        url = '%s?FLAGS=%s' % (self.xapian_url, flags)
        url = Env.search_url_config(url)

        self.assertEqual(url['ENGINE'], 'haystack.backends.xapian_backend.XapianEngine')
        self.assertTrue('PATH' in url.keys())
        self.assertEqual(url['PATH'], '/home/search/xapian_index')
        self.assertTrue('FLAGS' in url.keys())
        self.assertEqual(url['FLAGS'], flags)
        self.assertTrue('INDEX_NAME' not in url)
开发者ID:AliLozano,项目名称:django-environ,代码行数:13,代码来源:test.py

示例3: test_elasticsearch_parsing

# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import search_url_config [as 别名]
    def test_elasticsearch_parsing(self):
        timeout = 360
        url = '%s?TIMEOUT=%s' % (self.elasticsearch_url, timeout)
        url = Env.search_url_config(url)

        self.assertEqual(url['ENGINE'], 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine')
        self.assertTrue('INDEX_NAME' in url.keys())
        self.assertEqual(url['INDEX_NAME'], 'index')
        self.assertTrue('TIMEOUT' in url.keys())
        self.assertEqual(url['TIMEOUT'], timeout)
        self.assertTrue('PATH' not in url)
开发者ID:AliLozano,项目名称:django-environ,代码行数:13,代码来源:test.py

示例4: test_solr_multicore_parsing

# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import search_url_config [as 别名]
    def test_solr_multicore_parsing(self):
        timeout = 360
        index = 'solr_index'
        url = '%s/%s?TIMEOUT=%s' % (self.solr_url, index, timeout)
        url = Env.search_url_config(url)

        self.assertEqual(url['ENGINE'], 'haystack.backends.solr_backend.SolrEngine')
        self.assertEqual(url['URL'], 'http://127.0.0.1:8983/solr/solr_index')
        self.assertEqual(url['TIMEOUT'], timeout)
        self.assertTrue('INDEX_NAME' not in url)
        self.assertTrue('PATH' not in url)
开发者ID:AliLozano,项目名称:django-environ,代码行数:13,代码来源:test.py

示例5: test_whoosh_parsing

# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import search_url_config [as 别名]
    def test_whoosh_parsing(self):
        storage = 'file'  # or ram
        post_limit = 128 * 1024 * 1024
        url = '%s?STORAGE=%s&POST_LIMIT=%s' % (self.whoosh_url, storage, post_limit)
        url = Env.search_url_config(url)

        self.assertEqual(url['ENGINE'], 'haystack.backends.whoosh_backend.WhooshEngine')
        self.assertTrue('PATH' in url.keys())
        self.assertEqual(url['PATH'], '/home/search/whoosh_index')
        self.assertTrue('STORAGE' in url.keys())
        self.assertEqual(url['STORAGE'], storage)
        self.assertTrue('POST_LIMIT' in url.keys())
        self.assertEqual(url['POST_LIMIT'], post_limit)
        self.assertTrue('INDEX_NAME' not in url)
开发者ID:AliLozano,项目名称:django-environ,代码行数:16,代码来源:test.py

示例6: test_simple_parsing

# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import search_url_config [as 别名]
    def test_simple_parsing(self):
        url = Env.search_url_config(self.simple_url)

        self.assertEqual(url['ENGINE'], 'haystack.backends.simple_backend.SimpleEngine')
        self.assertTrue('INDEX_NAME' not in url)
        self.assertTrue('PATH' not in url)
开发者ID:AliLozano,项目名称:django-environ,代码行数:8,代码来源:test.py

示例7: test_solr_parsing

# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import search_url_config [as 别名]
    def test_solr_parsing(self):
        url = Env.search_url_config(self.solr_url)

        self.assertEqual(url['ENGINE'], 'haystack.backends.solr_backend.SolrEngine')
        self.assertEqual(url['URL'], 'http://127.0.0.1:8983/solr')
开发者ID:AliLozano,项目名称:django-environ,代码行数:7,代码来源:test.py


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