forked from inveniosoftware/invenio-accounts
-
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.
* Provides a programmatic way to revert user verification. * Avoids the need for direct database modifications. * Enables correction of verification errors from admin panel. * partially closes <inveniosoftware/invenio-administration#202>
- Loading branch information
Showing
2 changed files
with
23 additions
and
0 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 |
---|---|---|
|
@@ -288,3 +288,21 @@ def test_session_ip_no_country(app, users): | |
[session] = SessionActivity.query.all() | ||
assert session.country is None | ||
assert session.ip == "139.191.247.1" | ||
|
||
|
||
def test_unverify_user(app): | ||
"""Test unverifying a user.""" | ||
with app.app_context(): | ||
user = testutils.create_test_user( | ||
"[email protected]", | ||
verified_at=datetime.datetime.now(datetime.timezone.utc), | ||
) | ||
|
||
# Ensure the user starts off as verified | ||
assert user.verified_at is not None | ||
|
||
_datastore.unverify_user(user) | ||
db.session.commit() # Assuming that commit is needed to persist changes to the database | ||
|
||
# Ensure the user is no longer verified | ||
assert user.verified_at is None |