Add project board card move API
Some checks failed
cron-lock / action (push) Has been cancelled
cron-translations / crowdin-pull (push) Has been cancelled
cron-translations / crowdin-push (push) Has been cancelled
cron-licenses / cron-licenses (push) Has been cancelled

This commit is contained in:
Mikhail Kilin
2026-05-31 04:19:15 +03:00
parent ee3b2ac09d
commit f4963a22e2
4 changed files with 198 additions and 0 deletions

View File

@@ -51,6 +51,42 @@ func TestAPIListProjectBoards(t *testing.T) {
assert.Len(t, apiProjectBoards, 4)
}
func TestAPIMoveProjectBoardCard(t *testing.T) {
defer tests.PrepareTestEnv(t)()
token := getUserToken(t, "user2", auth_model.AccessTokenScopeWriteIssue)
link, _ := url.Parse("/api/v1/projects/1/boards/2/cards/1/move")
req := NewRequest(t, "POST", link.String()).AddTokenAuth(token)
MakeRequest(t, req, http.StatusNoContent)
projectIssue := unittest.AssertExistsAndLoadBean(t, &project_model.ProjectIssue{
ProjectID: 1,
IssueID: 1,
})
assert.EqualValues(t, 2, projectIssue.ProjectBoardID)
}
func TestAPIMoveProjectBoardCardRejectsWrongProjectBoard(t *testing.T) {
defer tests.PrepareTestEnv(t)()
token := getUserToken(t, "user2", auth_model.AccessTokenScopeWriteIssue)
link, _ := url.Parse("/api/v1/projects/1/boards/4/cards/1/move")
req := NewRequest(t, "POST", link.String()).AddTokenAuth(token)
MakeRequest(t, req, http.StatusNotFound)
}
func TestAPIMoveProjectBoardCardRejectsCardOutsideProject(t *testing.T) {
defer tests.PrepareTestEnv(t)()
token := getUserToken(t, "user2", auth_model.AccessTokenScopeWriteIssue)
link, _ := url.Parse("/api/v1/projects/1/boards/2/cards/4/move")
req := NewRequest(t, "POST", link.String()).AddTokenAuth(token)
MakeRequest(t, req, http.StatusNotFound)
}
func TestAPIGetProjectBoard(t *testing.T) {
defer tests.PrepareTestEnv(t)()