-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:ckan/ckan into 1908-remove-iconve…
…rters Conflicts: setup.py
- Loading branch information
Showing
31 changed files
with
1,055 additions
and
38 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
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
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
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
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,49 @@ | ||
import nose | ||
from ckan.lib.navl.dictization_functions import validate | ||
|
||
|
||
eq_ = nose.tools.eq_ | ||
|
||
|
||
class TestValidate(object): | ||
|
||
def test_validate_passes_a_copy_of_the_context_to_validators(self): | ||
|
||
# We need to pass some keys on the context, otherwise validate | ||
# will do context = context || {}, which creates a new one, defeating | ||
# the purpose of this test | ||
context = {'foo': 'bar'} | ||
|
||
def my_validator(key, data, errors, context_in_validator): | ||
|
||
assert not id(context) == id(context_in_validator) | ||
|
||
data_dict = { | ||
'my_field': 'test', | ||
} | ||
|
||
schema = { | ||
'my_field': [my_validator], | ||
} | ||
|
||
data, errors = validate(data_dict, schema, context) | ||
|
||
def test_validate_adds_schema_keys_to_context(self): | ||
|
||
def my_validator(key, data, errors, context): | ||
|
||
assert 'schema_keys' in context | ||
|
||
eq_(context['schema_keys'], ['my_field']) | ||
|
||
data_dict = { | ||
'my_field': 'test', | ||
} | ||
|
||
schema = { | ||
'my_field': [my_validator], | ||
} | ||
|
||
context = {} | ||
|
||
data, errors = validate(data_dict, schema, context) |
Oops, something went wrong.