-
Notifications
You must be signed in to change notification settings - Fork 98
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
Showing
4 changed files
with
46 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,3 +61,5 @@ target/ | |
# poetry | ||
poetry.lock | ||
|
||
# pytest | ||
.pytest_cache/ |
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,20 @@ | ||
import uuid | ||
|
||
from tests.conftest import all_dbs | ||
from tests.models import TestModel | ||
|
||
|
||
@all_dbs | ||
async def test_get_or_none(manager): | ||
"""Test get_or_none manager function.""" | ||
text1 = "Test %s" % uuid.uuid4() | ||
text2 = "Test %s" % uuid.uuid4() | ||
|
||
obj1 = await manager.create(TestModel, text=text1) | ||
obj2 = await manager.get_or_none(TestModel, text=text1) | ||
obj3 = await manager.get_or_none(TestModel, text=text2) | ||
|
||
assert obj1 == obj2 | ||
assert obj1 is not None | ||
assert obj2 is not None | ||
assert obj3 is None |