-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run
Entity.defaults
before validations
The `defaults` method was being run after setting `None` values to remaining fields which would already triggered errors for fields marked `required`. This commit runs `defaults` before so that field values can be set in `defaults` method safely before firing ValidationError exceptions. This method also contains fixes for test_support domains that need to explicitly look for a domain.toml config file.
- Loading branch information
Showing
5 changed files
with
21 additions
and
8 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 |
---|---|---|
|
@@ -15,7 +15,7 @@ def test_that_model_class_is_created_automatically(self, test_domain): | |
assert issubclass(model_cls, MemoryModel) | ||
assert model_cls.__name__ == "PersonModel" | ||
|
||
def test_conversation_from_entity_to_model(self, test_domain): | ||
def test_conversion_from_entity_to_model(self, test_domain): | ||
model_cls = test_domain.repository_for(Person)._model | ||
|
||
person = Person(first_name="John", last_name="Doe") | ||
|
@@ -28,7 +28,7 @@ def test_conversation_from_entity_to_model(self, test_domain): | |
assert person_model_obj["first_name"] == "John" | ||
assert person_model_obj["last_name"] == "Doe" | ||
|
||
def test_conversation_from_model_to_entity(self, test_domain): | ||
def test_conversion_from_model_to_entity(self, test_domain): | ||
model_cls = test_domain.repository_for(Person)._model | ||
person = Person(first_name="John", last_name="Doe") | ||
person_model_obj = model_cls.from_entity(person) | ||
|
@@ -47,7 +47,7 @@ def test_that_model_class_is_created_automatically(self, test_domain): | |
assert issubclass(model_cls, MemoryModel) | ||
assert model_cls.__name__ == "UserModel" | ||
|
||
def test_conversation_from_entity_to_model(self, test_domain): | ||
def test_conversion_from_entity_to_model(self, test_domain): | ||
model_cls = test_domain.repository_for(User)._model | ||
|
||
user1 = User(email_address="[email protected]", password="d4e5r6") | ||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from protean import Domain | ||
|
||
|
||
domain = Domain(__file__, "TEST18", load_toml=False) | ||
domain = Domain(__file__, "TEST18") |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from protean import Domain | ||
|
||
|
||
domain = Domain(__file__, "TEST19", load_toml=False) | ||
domain = Domain(__file__, "TEST19") |