(t *testing.T)
| 50 | } |
| 51 | |
| 52 | func TestUserRemoveCmd(t *testing.T) { |
| 53 | tmpDB := t.TempDir() + "/test.db" |
| 54 | |
| 55 | // Create a user first |
| 56 | db := testutils.InitDB(tmpDB) |
| 57 | testutils.SetupUserData(db, "test@example.com", "password123") |
| 58 | sqlDB, _ := db.DB() |
| 59 | sqlDB.Close() |
| 60 | |
| 61 | // Remove the user with mock stdin that responds "y" |
| 62 | mockStdin := strings.NewReader("y\n") |
| 63 | userRemoveCmd([]string{"--dbPath", tmpDB, "--email", "test@example.com"}, mockStdin) |
| 64 | |
| 65 | // Verify user was removed |
| 66 | db2 := testutils.InitDB(tmpDB) |
| 67 | defer func() { |
| 68 | sqlDB2, _ := db2.DB() |
| 69 | sqlDB2.Close() |
| 70 | }() |
| 71 | |
| 72 | var count int64 |
| 73 | testutils.MustExec(t, db2.Model(&database.User{}).Count(&count), "counting users") |
| 74 | assert.Equal(t, count, int64(0), "should have 0 users") |
| 75 | } |
| 76 | |
| 77 | func TestUserResetPasswordCmd(t *testing.T) { |
| 78 | tmpDB := t.TempDir() + "/test.db" |
nothing calls this directly
no test coverage detected