Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allows the disabling of datastore_search_sql
Although the datastore is useful, it may be that some users may will to disable the specific datastore_search_sql. This commit allows them to do that.
- Loading branch information
Showing
3 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
import pylons.config as config | ||
import ckan.plugins as p | ||
import nose.tools as t | ||
|
||
|
||
class TestDisable(object): | ||
|
||
@classmethod | ||
def setup_class(cls): | ||
with p.use_plugin('datastore') as the_plugin: | ||
legacy = the_plugin.legacy_mode | ||
|
||
if legacy: | ||
raise nose.SkipTest("SQL tests are not supported in legacy mode") | ||
|
||
@t.raises(KeyError) | ||
def test_disable_sql_search(self): | ||
config['ckan.datastore.sqlsearch.enabled'] = False | ||
with p.use_plugin('datastore') as the_plugin: | ||
print p.toolkit.get_action('datastore_search_sql') | ||
config['ckan.datastore.sqlsearch.enabled'] = True | ||
|
||
def test_enabled_sql_search(self): | ||
config['ckan.datastore.sqlsearch.enabled'] = True | ||
with p.use_plugin('datastore') as the_plugin: | ||
p.toolkit.get_action('datastore_search_sql') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters