Skip to content

Commit 79bc6e8

Browse files
Gustedforgejo-backport-action
authored andcommitted
chore: add extra integration test
(cherry picked from commit 536e192)
1 parent 770fa89 commit 79bc6e8

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/integration/codeowner_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package integration
66
import (
77
"context"
88
"fmt"
9+
"net/http"
910
"net/url"
1011
"os"
1112
"path"
@@ -136,5 +137,27 @@ func TestCodeOwner(t *testing.T) {
136137
unittest.AssertExistsIf(t, true, &issues_model.Review{IssueID: pr.IssueID, Type: issues_model.ReviewTypeRequest, ReviewerID: 4})
137138
unittest.AssertExistsIf(t, false, &issues_model.Review{IssueID: pr.IssueID, Type: issues_model.ReviewTypeRequest, ReviewerID: 5})
138139
})
140+
t.Run("From a forked repository", func(t *testing.T) {
141+
defer tests.PrintCurrentTest(t)()
142+
143+
session := loginUser(t, "user1")
144+
145+
r := fmt.Sprintf("%suser1/repo1.git", u.String())
146+
remoteURL, _ := url.Parse(r)
147+
remoteURL.User = url.UserPassword("user1", userPassword)
148+
doGitAddRemote(dstPath, "forked-2", remoteURL)(t)
149+
150+
err := git.NewCommand(git.DefaultContext, "push", "forked-2", "HEAD:branch").Run(&git.RunOpts{Dir: dstPath})
151+
require.NoError(t, err)
152+
153+
req := NewRequestWithValues(t, "POST", repo.FullName()+"/compare/main...user1/repo1:branch", map[string]string{
154+
"_csrf": GetCSRF(t, session, repo.FullName()+"/compare/main...user1/repo1:branch"),
155+
"title": "pull request",
156+
})
157+
session.MakeRequest(t, req, http.StatusOK)
158+
159+
pr := unittest.AssertExistsAndLoadBean(t, &issues_model.PullRequest{BaseRepoID: repo.ID, HeadBranch: "branch"})
160+
unittest.AssertExistsIf(t, true, &issues_model.Review{IssueID: pr.IssueID, Type: issues_model.ReviewTypeRequest, ReviewerID: 4})
161+
})
139162
})
140163
}

0 commit comments

Comments
 (0)