generated from MasoniteFramework/starter-package
-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b9dd047
commit 22a5c01
Showing
6 changed files
with
28 additions
and
59 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,10 +113,7 @@ def test_create_can_use_guarded_asterisk(self): | |
|
||
# An asterisk guarded attribute excludes all fields from mass-assignment. | ||
# This would raise a DB error if there are any required fields. | ||
self.assertEqual( | ||
sql, | ||
"INSERT INTO `profiles` (*) VALUES ()", | ||
) | ||
self.assertEqual(sql, "INSERT INTO `profiles` (*) VALUES ()") | ||
|
||
def test_bulk_create_can_use_fillable(self): | ||
query_builder = ProfileFillable.bulk_create( | ||
|
@@ -173,8 +170,7 @@ def test_bulk_create_can_use_guarded_asterisk(self): | |
# This would obviously raise an invalid SQL syntax error. | ||
# TODO: Raise a clearer error? | ||
self.assertEqual( | ||
query_builder.to_sql(), | ||
"INSERT INTO `profiles` () VALUES (), ()", | ||
query_builder.to_sql(), "INSERT INTO `profiles` () VALUES (), ()" | ||
) | ||
|
||
def test_update_can_use_fillable(self): | ||
|
@@ -214,10 +210,7 @@ def test_update_can_use_guarded_asterisk(self): | |
|
||
# An asterisk guarded attribute excludes all fields from mass-assignment. | ||
# The query builder's sql should not have been altered in any way. | ||
self.assertEqual( | ||
query_builder.to_sql(), | ||
initial_sql, | ||
) | ||
self.assertEqual(query_builder.to_sql(), initial_sql) | ||
|
||
def test_table_name(self): | ||
table_name = Profile.get_table_name() | ||
|
@@ -250,25 +243,15 @@ def test_serialize_with_hidden(self): | |
|
||
def test_serialize_with_visible(self): | ||
profile = ProfileSerializeWithVisible.hydrate( | ||
{ | ||
"name": "Joe", | ||
"id": 1, | ||
"password": "secret", | ||
"email": "[email protected]", | ||
} | ||
{"name": "Joe", "id": 1, "password": "secret", "email": "[email protected]"} | ||
) | ||
self.assertTrue( | ||
{"name": "Joe", "email": "[email protected]"}, profile.serialize() | ||
) | ||
|
||
def test_serialize_with_visible_and_hidden_raise_error(self): | ||
profile = ProfileSerializeWithVisibleAndHidden.hydrate( | ||
{ | ||
"name": "Joe", | ||
"id": 1, | ||
"password": "secret", | ||
"email": "[email protected]", | ||
} | ||
{"name": "Joe", "id": 1, "password": "secret", "email": "[email protected]"} | ||
) | ||
with self.assertRaises(AttributeError): | ||
profile.serialize() | ||
|
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