Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'k-nut-3060-set-formencode-default-lang'
- Loading branch information
Showing
3 changed files
with
38 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
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,30 @@ | ||
import nose | ||
import pylons | ||
|
||
from ckan.tests import helpers | ||
from ckan.config import environment | ||
|
||
eq_ = nose.tools.eq_ | ||
|
||
|
||
class TestFormencdoeLanguage(object): | ||
@helpers.change_config('ckan.locale_default', 'de') | ||
def test_formencode_uses_locale_default(self): | ||
environment.update_config() | ||
from ckan.lib.navl.dictization_functions import validate | ||
from ckan.lib.navl.validators import not_empty | ||
from formencode import validators | ||
schema = { | ||
"name": [not_empty, unicode], | ||
"email": [validators.Email], | ||
"email2": [validators.Email], | ||
} | ||
|
||
data = { | ||
"name": "fred", | ||
"email": "32", | ||
"email2": "david@david.com", | ||
} | ||
|
||
converted_data, errors = validate(data, schema) | ||
eq_({'email': [u'Eine E-Mail-Adresse muss genau ein @-Zeichen enthalten']}, errors) |