-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: add tests for fuzzy search on multiple model attributes
- Loading branch information
Showing
1 changed file
with
13 additions
and
2 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 |
---|---|---|
|
@@ -163,7 +163,7 @@ def test_model_indexation(testclient, backend): | |
assert not models.User.get(emails=["[email protected]"]) | ||
|
||
|
||
def test_fuzzy(user, moderator, admin, backend): | ||
def test_fuzzy_unique_attribute(user, moderator, admin, backend): | ||
assert set(models.User.query()) == {user, moderator, admin} | ||
assert set(models.User.fuzzy("Jack")) == {moderator} | ||
assert set(models.User.fuzzy("Jack", ["formatted_name"])) == {moderator} | ||
|
@@ -177,7 +177,18 @@ def test_fuzzy(user, moderator, admin, backend): | |
assert set(models.User.fuzzy("ack")) == {moderator} | ||
|
||
|
||
# def test_model_references(user, admin, foo_group, bar_group): | ||
def test_fuzzy_multiple_attribute(user, moderator, admin, backend): | ||
assert set(models.User.query()) == {user, moderator, admin} | ||
assert set(models.User.fuzzy("[email protected]")) == {moderator} | ||
assert set(models.User.fuzzy("[email protected]", ["emails"])) == {moderator} | ||
assert set(models.User.fuzzy("[email protected]", ["formatted_name"])) == set() | ||
assert set(models.User.fuzzy("[email protected]", ["emails", "formatted_name"])) == { | ||
moderator | ||
} | ||
assert set(models.User.fuzzy("[email protected]")) == {moderator} | ||
assert set(models.User.fuzzy("doe.com")) == {user, moderator, admin} | ||
|
||
|
||
def test_model_references(testclient, user, foo_group, admin, bar_group, backend): | ||
# assert foo_group.members == [user] | ||
# assert user.groups == [foo_group] | ||
|