Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose config and translator via toolkit.
To avoid importing of pylons in extensions, we should include the most commonly imported pylons modules in the plugin toolkit. This PR does that in order to fix #2776
- Loading branch information
Showing
2 changed files
with
35 additions
and
0 deletions.
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,19 @@ | ||
import ckan.tests.helpers as helpers | ||
|
||
from nose.tools import assert_equals, assert_not_equals | ||
import ckan.plugins.toolkit as t | ||
from pylons import config | ||
from pylons import translator | ||
|
||
class TestToolkit(helpers.FunctionalTestBase): | ||
|
||
def test_config_is_in_toolkit(self): | ||
assert sorted(t.config.keys()) == sorted(config.keys()) | ||
|
||
def test_config_values_are_accurate(self): | ||
for k, v in t.config.iteritems(): | ||
assert config[k] == v | ||
|
||
def test_translator(self): | ||
assert translator.gettext("Test") == \ | ||
t.translator.gettext("Test") |