Skip to content

Commit 223537f

Browse files
cassiozareckearl-warren
authored andcommitted
[GITEA] add GitHub repo migration test
Signed-off-by: zareck <[email protected]> (cherry picked from commit f48e3ff0db027c6420446c0bab3089d9a46194a8) Removing comments and make command (cherry picked from commit 7664a423a5abf051383374b4156857e83faee7c0) (cherry picked from commit b2fb43536424f90373fdc177bd2c79c374efd2be) (cherry picked from commit 0a24a819a9561c8355adb00b7b202438c5c1bc1a) (cherry picked from commit 155cc19f75662998fcb2a1a08e345e0724437a58)
1 parent 9ce8aa5 commit 223537f

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

tests/integration/repo_migrate_test.go

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import (
1515
"github.com/stretchr/testify/assert"
1616
)
1717

18-
func testRepoMigrate(t testing.TB, session *TestSession, cloneAddr, repoName string) *httptest.ResponseRecorder {
19-
req := NewRequest(t, "GET", fmt.Sprintf("/repo/migrate?service_type=%d", structs.PlainGitService)) // render plain git migration page
18+
func testRepoMigrate(t testing.TB, session *TestSession, cloneAddr, repoName string, service structs.GitServiceType) *httptest.ResponseRecorder {
19+
req := NewRequest(t, "GET", fmt.Sprintf("/repo/migrate?service_type=%d", service)) // render plain git migration page
2020
resp := session.MakeRequest(t, req, http.StatusOK)
2121
htmlDoc := NewHTMLParser(t, resp.Body)
2222

@@ -31,7 +31,7 @@ func testRepoMigrate(t testing.TB, session *TestSession, cloneAddr, repoName str
3131
"clone_addr": cloneAddr,
3232
"uid": uid,
3333
"repo_name": repoName,
34-
"service": fmt.Sprintf("%d", structs.PlainGitService),
34+
"service": fmt.Sprintf("%d", service),
3535
})
3636
resp = session.MakeRequest(t, req, http.StatusSeeOther)
3737

@@ -41,5 +41,17 @@ func testRepoMigrate(t testing.TB, session *TestSession, cloneAddr, repoName str
4141
func TestRepoMigrate(t *testing.T) {
4242
defer tests.PrepareTestEnv(t)()
4343
session := loginUser(t, "user2")
44-
testRepoMigrate(t, session, "https://github.com/go-gitea/test_repo.git", "git")
44+
for _, s := range []struct {
45+
testName string
46+
cloneAddr string
47+
repoName string
48+
service structs.GitServiceType
49+
}{
50+
{"TestMigrateGithub", "https://github.com/go-gitea/test_repo.git", "git", structs.PlainGitService},
51+
{"TestMigrateGithub", "https://github.com/go-gitea/test_repo.git", "github", structs.GithubService},
52+
} {
53+
t.Run(s.testName, func(t *testing.T) {
54+
testRepoMigrate(t, session, s.cloneAddr, s.repoName, s.service)
55+
})
56+
}
4557
}

0 commit comments

Comments
 (0)