aboutsummaryrefslogtreecommitdiff
path: root/internal/db/users_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/db/users_test.go')
-rw-r--r--internal/db/users_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/db/users_test.go b/internal/db/users_test.go
index 6d71ad5a..9c940f6b 100644
--- a/internal/db/users_test.go
+++ b/internal/db/users_test.go
@@ -93,6 +93,7 @@ func TestUsers(t *testing.T) {
{"GetByID", usersGetByID},
{"GetByUsername", usersGetByUsername},
{"HasForkedRepository", usersHasForkedRepository},
+ {"IsUsernameUsed", usersIsUsernameUsed},
{"ListFollowers", usersListFollowers},
{"ListFollowings", usersListFollowings},
{"UseCustomAvatar", usersUseCustomAvatar},
@@ -390,6 +391,18 @@ func usersHasForkedRepository(t *testing.T, db *users) {
assert.True(t, has)
}
+func usersIsUsernameUsed(t *testing.T, db *users) {
+ ctx := context.Background()
+
+ alice, err := db.Create(ctx, "alice", "alice@example.com", CreateUserOptions{})
+ require.NoError(t, err)
+
+ got := db.IsUsernameUsed(ctx, alice.Name)
+ assert.True(t, got)
+ got = db.IsUsernameUsed(ctx, "bob")
+ assert.False(t, got)
+}
+
func usersListFollowers(t *testing.T, db *users) {
ctx := context.Background()