|
6 | 6 | "testing"
|
7 | 7 | "time"
|
8 | 8 |
|
| 9 | + "github.com/google/uuid" |
9 | 10 | "github.com/stretchr/testify/require"
|
10 | 11 |
|
11 | 12 | "cdr.dev/slog"
|
@@ -259,14 +260,36 @@ func TestEntitlements(t *testing.T) {
|
259 | 260 | t.Run("TooManyUsers", func(t *testing.T) {
|
260 | 261 | t.Parallel()
|
261 | 262 | db := dbfake.New()
|
262 |
| - db.InsertUser(context.Background(), database.InsertUserParams{ |
| 263 | + activeUser1, err := db.InsertUser(context.Background(), database.InsertUserParams{ |
| 264 | + ID: uuid.New(), |
263 | 265 | Username: "test1",
|
264 | 266 | LoginType: database.LoginTypePassword,
|
265 | 267 | })
|
266 |
| - db.InsertUser(context.Background(), database.InsertUserParams{ |
| 268 | + require.NoError(t, err) |
| 269 | + _, err = db.UpdateUserStatus(context.Background(), database.UpdateUserStatusParams{ |
| 270 | + ID: activeUser1.ID, |
| 271 | + Status: database.UserStatusActive, |
| 272 | + UpdatedAt: database.Now(), |
| 273 | + }) |
| 274 | + require.NoError(t, err) |
| 275 | + activeUser2, err := db.InsertUser(context.Background(), database.InsertUserParams{ |
| 276 | + ID: uuid.New(), |
267 | 277 | Username: "test2",
|
268 | 278 | LoginType: database.LoginTypePassword,
|
269 | 279 | })
|
| 280 | + require.NoError(t, err) |
| 281 | + _, err = db.UpdateUserStatus(context.Background(), database.UpdateUserStatusParams{ |
| 282 | + ID: activeUser2.ID, |
| 283 | + Status: database.UserStatusActive, |
| 284 | + UpdatedAt: database.Now(), |
| 285 | + }) |
| 286 | + require.NoError(t, err) |
| 287 | + _, err = db.InsertUser(context.Background(), database.InsertUserParams{ |
| 288 | + ID: uuid.New(), |
| 289 | + Username: "dormant-user", |
| 290 | + LoginType: database.LoginTypePassword, |
| 291 | + }) |
| 292 | + require.NoError(t, err) |
270 | 293 | db.InsertLicense(context.Background(), database.InsertLicenseParams{
|
271 | 294 | JWT: coderdenttest.GenerateLicense(t, coderdenttest.LicenseOptions{
|
272 | 295 | Features: license.Features{
|
|
0 commit comments