test: enable github migration tests
This commit is contained in:
parent
e40c8f0d21
commit
c68fcaf53d
34 changed files with 810 additions and 10 deletions
|
@ -10,6 +10,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
base "code.gitea.io/gitea/modules/migration"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -18,11 +19,13 @@ import (
|
|||
|
||||
func TestGitHubDownloadRepo(t *testing.T) {
|
||||
GithubLimitRateRemaining = 3 // Wait at 3 remaining since we could have 3 CI in //
|
||||
|
||||
token := os.Getenv("GITHUB_READ_TOKEN")
|
||||
if token == "" {
|
||||
t.Skip("Skipping GitHub migration test because GITHUB_READ_TOKEN is empty")
|
||||
}
|
||||
downloader := NewGithubDownloaderV3(context.Background(), "https://github.com", "", "", token, "go-gitea", "test_repo")
|
||||
fixturePath := "./testdata/github/full_download"
|
||||
server := unittest.NewMockWebServer(t, "https://api.github.com", fixturePath, token != "")
|
||||
defer server.Close()
|
||||
|
||||
downloader := NewGithubDownloaderV3(context.Background(), server.URL, "", "", token, "go-gitea", "test_repo")
|
||||
err := downloader.RefreshRate()
|
||||
require.NoError(t, err)
|
||||
|
||||
|
@ -32,8 +35,8 @@ func TestGitHubDownloadRepo(t *testing.T) {
|
|||
Name: "test_repo",
|
||||
Owner: "go-gitea",
|
||||
Description: "Test repository for testing migration from github to gitea",
|
||||
CloneURL: "https://github.com/go-gitea/test_repo.git",
|
||||
OriginalURL: "https://github.com/go-gitea/test_repo",
|
||||
CloneURL: server.URL + "/go-gitea/test_repo.git",
|
||||
OriginalURL: server.URL + "/go-gitea/test_repo",
|
||||
DefaultBranch: "master",
|
||||
}, repo)
|
||||
|
||||
|
@ -269,10 +272,10 @@ func TestGitHubDownloadRepo(t *testing.T) {
|
|||
Description: "Improvements or additions to documentation",
|
||||
},
|
||||
},
|
||||
PatchURL: "https://github.com/go-gitea/test_repo/pull/3.patch",
|
||||
PatchURL: server.URL + "/go-gitea/test_repo/pull/3.patch",
|
||||
Head: base.PullRequestBranch{
|
||||
Ref: "master",
|
||||
CloneURL: "https://github.com/mrsdizzie/test_repo.git",
|
||||
CloneURL: server.URL + "/mrsdizzie/test_repo.git",
|
||||
SHA: "076160cf0b039f13e5eff19619932d181269414b",
|
||||
RepoName: "test_repo",
|
||||
|
||||
|
@ -307,13 +310,13 @@ func TestGitHubDownloadRepo(t *testing.T) {
|
|||
Description: "Something isn't working",
|
||||
},
|
||||
},
|
||||
PatchURL: "https://github.com/go-gitea/test_repo/pull/4.patch",
|
||||
PatchURL: server.URL + "/go-gitea/test_repo/pull/4.patch",
|
||||
Head: base.PullRequestBranch{
|
||||
Ref: "test-branch",
|
||||
SHA: "2be9101c543658591222acbee3eb799edfc3853d",
|
||||
RepoName: "test_repo",
|
||||
OwnerName: "mrsdizzie",
|
||||
CloneURL: "https://github.com/mrsdizzie/test_repo.git",
|
||||
CloneURL: server.URL + "/mrsdizzie/test_repo.git",
|
||||
},
|
||||
Base: base.PullRequestBranch{
|
||||
Ref: "master",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue