forked from rero/rero-ils
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
users: fix get REST API for a user without profile
* Fixes internal serveur error when we search for a user without profile. * Fixes internal serveur error for the user search API without the `q` parameter. Co-Authored-by: Johnny Mariéthoz <[email protected]>
- Loading branch information
Showing
4 changed files
with
44 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,14 +31,29 @@ | |
from rero_ils.modules.items.api import Item, ItemsSearch | ||
|
||
|
||
@pytest.fixture(scope='function') | ||
def user_without_profile(db, default_user_password): | ||
"""Create a simple invenio user with a profile.""" | ||
with db.session.begin_nested(): | ||
user = User( | ||
email='[email protected]', | ||
password=hash_password(default_user_password), | ||
user_profile=None, | ||
active=True, | ||
) | ||
db.session.add(user) | ||
db.session.commit() | ||
return user | ||
|
||
|
||
@pytest.fixture(scope='function') | ||
def user_with_profile(db, default_user_password): | ||
"""Create a simple invenio user with a profile.""" | ||
with db.session.begin_nested(): | ||
user = User( | ||
email='[email protected]', | ||
password=hash_password(default_user_password), | ||
profile={}, | ||
user_profile={}, | ||
active=True, | ||
) | ||
db.session.add(user) | ||
|
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