@@ -507,7 +507,10 @@ func TestAPIAddIssueToProjectColumn(t *testing.T) {
507507 MakeRequest (t , req , http .StatusCreated )
508508
509509 // Verify issue is in the column
510- projectIssue := unittest .AssertExistsAndLoadBean (t , & project_model.ProjectIssue {IssueID : issue .ID })
510+ projectIssue := unittest .AssertExistsAndLoadBean (t , & project_model.ProjectIssue {
511+ ProjectID : project .ID ,
512+ IssueID : issue .ID ,
513+ })
511514 assert .Equal (t , column1 .ID , projectIssue .ProjectColumnID )
512515
513516 // Test moving issue to another column
@@ -517,7 +520,10 @@ func TestAPIAddIssueToProjectColumn(t *testing.T) {
517520 MakeRequest (t , req , http .StatusCreated )
518521
519522 // Verify issue moved to new column
520- projectIssue = unittest .AssertExistsAndLoadBean (t , & project_model.ProjectIssue {IssueID : issue .ID })
523+ projectIssue = unittest .AssertExistsAndLoadBean (t , & project_model.ProjectIssue {
524+ ProjectID : project .ID ,
525+ IssueID : issue .ID ,
526+ })
521527 assert .Equal (t , column2 .ID , projectIssue .ProjectColumnID )
522528
523529 // Test adding same issue to same column (should be idempotent)
@@ -544,7 +550,7 @@ func TestAPIProjectPermissions(t *testing.T) {
544550
545551 repo := unittest .AssertExistsAndLoadBean (t , & repo_model.Repository {ID : 1 })
546552 owner := unittest .AssertExistsAndLoadBean (t , & user_model.User {ID : repo .OwnerID })
547- user2 := unittest .AssertExistsAndLoadBean (t , & user_model.User {Name : "user2 " })
553+ nonCollaborator := unittest .AssertExistsAndLoadBean (t , & user_model.User {Name : "user1 " })
548554
549555 // Create a test project
550556 project := & project_model.Project {
@@ -561,7 +567,7 @@ func TestAPIProjectPermissions(t *testing.T) {
561567 }()
562568
563569 ownerToken := getUserToken (t , owner .Name , auth_model .AccessTokenScopeWriteIssue )
564- user2Token := getUserToken (t , user2 .Name , auth_model .AccessTokenScopeWriteIssue )
570+ nonCollaboratorToken := getUserToken (t , nonCollaborator .Name , auth_model .AccessTokenScopeWriteIssue )
565571
566572 // Owner should be able to read
567573 req := NewRequestf (t , "GET" , "/api/v1/repos/%s/%s/projects/%d" , owner .Name , repo .Name , project .ID ).
@@ -575,15 +581,15 @@ func TestAPIProjectPermissions(t *testing.T) {
575581 }).AddTokenAuth (ownerToken )
576582 MakeRequest (t , req , http .StatusOK )
577583
578- // User2 (non -collaborator) should not be able to update
579- anotherTitle := "Updated by User2 "
584+ // Non -collaborator should not be able to update
585+ anotherTitle := "Updated by Non-collaborator "
580586 req = NewRequestWithJSON (t , "PATCH" , fmt .Sprintf ("/api/v1/repos/%s/%s/projects/%d" , owner .Name , repo .Name , project .ID ), & api.EditProjectOption {
581587 Title : & anotherTitle ,
582- }).AddTokenAuth (user2Token )
588+ }).AddTokenAuth (nonCollaboratorToken )
583589 MakeRequest (t , req , http .StatusForbidden )
584590
585- // User2 should not be able to delete
591+ // Non-collaborator should not be able to delete
586592 req = NewRequestf (t , "DELETE" , "/api/v1/repos/%s/%s/projects/%d" , owner .Name , repo .Name , project .ID ).
587- AddTokenAuth (user2Token )
593+ AddTokenAuth (nonCollaboratorToken )
588594 MakeRequest (t , req , http .StatusForbidden )
589595}
0 commit comments