Skip to content

Commit

Permalink
Test User.username model definition (unique constraint)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavcs committed Jun 3, 2024
1 parent b3a097a commit 38076f0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/unit/data/model/db/test_user.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest
from sqlalchemy.exc import IntegrityError

from galaxy.model.db.user import (
get_user_by_email,
Expand Down Expand Up @@ -72,3 +73,10 @@ def test_get_users_for_index(session, make_user):
u1.deleted = True
users = get_users_for_index(session, True)
verify_items(users, [u1])


def test_username_is_unique(make_user):
# Verify username model definition
make_user(username="a")
with pytest.raises(IntegrityError):
make_user(username="a")

0 comments on commit 38076f0

Please sign in to comment.