This commit is contained in:
2024-12-16 18:12:54 +01:00
parent f6bd0c10c0
commit ac6fb96534
6 changed files with 92 additions and 56 deletions

View File

@@ -75,8 +75,8 @@ func TestSyncPR(t *testing.T) {
Ref: "branch",
Sha: "11eb36d5a58d7bb376cac59ac729a1986c6a7bfc63e7818e14382f545ccda985",
Repo: &models.Repository{
Name: "testRepo",
Owner: &models.User {
Name: "testRepo",
Owner: &models.User{
UserName: "test",
},
DefaultBranch: "main1",
@@ -116,7 +116,6 @@ func TestSyncPR(t *testing.T) {
}
})
/*
t.Run("Missing submodule in prjgit", func(t *testing.T) {
ctl := gomock.NewController(t)
mock := mock_common.NewMockGitea(ctl)
@@ -125,20 +124,23 @@ func TestSyncPR(t *testing.T) {
git.GitPath = t.TempDir()
config.GitProjectName = "prjGit"
event.Repository.Name = "tester"
event.Repository.Name = "testRepo"
setupGitForTests(t, git)
// mock.EXPECT().GetAssociatedPrjGitPR(event).Return(PrjGitPR, nil)
oldSha := PrjGitPR.Head.Sha
defer func() { PrjGitPR.Head.Sha = oldSha }()
PrjGitPR.Head.Sha = "ab8adab91edb476b9762097d10c6379aa71efd6b60933a1c0e355ddacf419a95"
mock.EXPECT().GetPullRequestAndReviews(config.Organization, "testRepo", event.Pull_Request.Number).Return(modelPR, nil, nil)
mock.EXPECT().GetPullRequestAndReviews(config.Organization, "prj", int64(24)).Return(PrjGitPR, nil, nil)
err := pr.Process(event, git, config)
if err == nil || err.Error() != "Cannot fetch submodule commit id in prjgit for 'tester'" {
if err == nil || err.Error() != "Cannot fetch submodule commit id in prjgit for 'testRepo'" {
t.Error("Invalid error received.", err)
}
})
*/
t.Run("Missing PrjGit PR for the sync", func(t *testing.T) {
ctl := gomock.NewController(t)