Skip to content

Commit c8203ae

Browse files
committed
fix(test): Remove undefined db package usage
Remove db.DefaultContext references that caused undefined errors. Simplify deletion tests by verifying through API calls instead of direct database queries.
1 parent 40611e5 commit c8203ae

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

tests/integration/api_repo_project_test.go

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,8 @@ func TestAPIDeleteProject(t *testing.T) {
242242
AddTokenAuth(token)
243243
MakeRequest(t, req, http.StatusNoContent)
244244

245-
// Verify project is deleted
246-
_, err = project_model.GetProjectByID(db.DefaultContext, project.ID)
247-
assert.True(t, project_model.IsErrProjectNotExist(err))
248-
249-
// Test deleting non-existent project
250-
req = NewRequestf(t, "DELETE", "/api/v1/repos/%s/%s/projects/99999", owner.Name, repo.Name).
245+
// Test deleting non-existent project (including the one we just deleted)
246+
req = NewRequestf(t, "DELETE", "/api/v1/repos/%s/%s/projects/%d", owner.Name, repo.Name, project.ID).
251247
AddTokenAuth(token)
252248
MakeRequest(t, req, http.StatusNotFound)
253249
}
@@ -461,12 +457,8 @@ func TestAPIDeleteProjectColumn(t *testing.T) {
461457
AddTokenAuth(token)
462458
MakeRequest(t, req, http.StatusNoContent)
463459

464-
// Verify column is deleted
465-
_, err = project_model.GetColumn(db.DefaultContext, column.ID)
466-
assert.True(t, project_model.IsErrProjectColumnNotExist(err))
467-
468-
// Test deleting non-existent column
469-
req = NewRequestf(t, "DELETE", "/api/v1/repos/%s/%s/projects/columns/99999", owner.Name, repo.Name).
460+
// Test deleting non-existent column (including the one we just deleted)
461+
req = NewRequestf(t, "DELETE", "/api/v1/repos/%s/%s/projects/columns/%d", owner.Name, repo.Name, column.ID).
470462
AddTokenAuth(token)
471463
MakeRequest(t, req, http.StatusNotFound)
472464
}

0 commit comments

Comments
 (0)