Skip to content

Commit 56b8a0d

Browse files
committed
fix user gen
1 parent 1a9b6a2 commit 56b8a0d

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

enterprise/cli/server_dbcrypt_test.go

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -236,15 +236,18 @@ func genData(t *testing.T, db database.Store) []database.User {
236236
OAuthAccessToken: "access-" + usr.ID.String(),
237237
OAuthRefreshToken: "refresh-" + usr.ID.String(),
238238
})
239-
// Fun fact: our schema allows _all_ login types to have
240-
// a user_link. Even though I'm not sure how it could occur
241-
// in practice, making sure to test all combinations here.
242-
_ = dbgen.UserLink(t, db, database.UserLink{
243-
UserID: usr.ID,
244-
LoginType: usr.LoginType,
245-
OAuthAccessToken: "access-" + usr.ID.String(),
246-
OAuthRefreshToken: "refresh-" + usr.ID.String(),
247-
})
239+
// Deleted users cannot have user_links
240+
if !deleted {
241+
// Fun fact: our schema allows _all_ login types to have
242+
// a user_link. Even though I'm not sure how it could occur
243+
// in practice, making sure to test all combinations here.
244+
_ = dbgen.UserLink(t, db, database.UserLink{
245+
UserID: usr.ID,
246+
LoginType: usr.LoginType,
247+
OAuthAccessToken: "access-" + usr.ID.String(),
248+
OAuthRefreshToken: "refresh-" + usr.ID.String(),
249+
})
250+
}
248251
users = append(users, usr)
249252
}
250253
}

0 commit comments

Comments
 (0)