| def test_source_keys_reset_between_validations():
|
| """
|
| Ensure that calling validate with source_keys=None resets to default keys.
|
| """
|
| schema_filter = {'model': 'tests.models.Company', 'filter': {'foo': 'bar'}}
|
| schema_data = {'model': 'tests.models.Company', 'data': {'foo': 'bar'}}
|
|
|
| # Default behavior should accept filter
|
| > assert SchemaValidator.validate(schema_filter) is None
|
|
|
| sqlalchemyseed/grader_tests/test_validator_more.py:36:
|
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
| sqlalchemyseed/validator.py:128: in validate
|
| cls._pre_validate(entities, is_parent=True, ref_prefix=ref_prefix)
|
| sqlalchemyseed/validator.py:142: in _pre_validate
|
| return cls._validate(entities, is_parent, ref_prefix)
|
| sqlalchemyseed/validator.py:158: in _validate
|
| check_model_key(entity, entity_is_parent)
|
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
| entity = {'filter': {'foo': 'bar'}, 'model': 'tests.models.Company'}
|
| entity_is_parent = True
|
|
|
| def check_model_key(entity: dict, entity_is_parent: bool):
|
| model = Key.model()
|
| if model not in entity and entity_is_parent:
|
| > raise errors.MissingRequiredKeyError("'model' key is missing.")
|
| E sqlalchemyseed.errors.MissingRequiredKeyError: 'model' key is missing.
|
|
|
| sqlalchemyseed/validator.py:71: MissingRequiredKeyError
|