diff --git a/services/migrations/gitea_downloader_test.go b/services/migrations/gitea_downloader_test.go index df734c3ace..a4a4f29ddb 100644 --- a/services/migrations/gitea_downloader_test.go +++ b/services/migrations/gitea_downloader_test.go @@ -407,9 +407,15 @@ func createForgejoIssueComments(comments []*gitea_sdk.Comment) []*base.Comment { } func TestBreakConditions(t *testing.T) { + giteaToken := os.Getenv("GITEA_TOKEN") + + fixturePath := "./testdata/gitea/breaking_conditions" + server := unittest.NewMockWebServer(t, "https://gitea.com", fixturePath, giteaToken != "") + defer server.Close() + // Client giteaClient, err := gitea_sdk.NewClient( - "https://gitea.com", + server.URL, gitea_sdk.SetToken(""), gitea_sdk.SetBasicAuth("", ""), gitea_sdk.SetContext(t.Context()), @@ -418,7 +424,7 @@ func TestBreakConditions(t *testing.T) { require.NoError(t, err, "Clould not create Client") // Downloader - downloader, err := NewGiteaDownloader(t.Context(), giteaClient, "https://gitea.com", "gitea/test_repo") + downloader, err := NewGiteaDownloader(t.Context(), giteaClient, server.URL, "gitea/test_repo") if downloader == nil { t.Fatal("NewGiteaDownloader is nil") } diff --git a/services/migrations/testdata/gitea/breaking_conditions/GET_%2Fapi%2Fv1%2Fsettings%2Fapi b/services/migrations/testdata/gitea/breaking_conditions/GET_%2Fapi%2Fv1%2Fsettings%2Fapi new file mode 100644 index 0000000000..87fb421d8e --- /dev/null +++ b/services/migrations/testdata/gitea/breaking_conditions/GET_%2Fapi%2Fv1%2Fsettings%2Fapi @@ -0,0 +1,9 @@ +Alt-Svc: h3=":443"; ma=2592000 +Content-Type: application/json;charset=utf-8 +Vary: Origin +Content-Length: 155 +Cache-Control: max-age=0, private, must-revalidate, no-transform +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN + +{"max_response_items":50,"default_paging_num":10,"default_git_trees_per_page":1000,"default_max_blob_size":10485760,"default_max_response_size":104857600} diff --git a/services/migrations/testdata/gitea/breaking_conditions/GET_%2Fapi%2Fv1%2Fversion b/services/migrations/testdata/gitea/breaking_conditions/GET_%2Fapi%2Fv1%2Fversion new file mode 100644 index 0000000000..341ab432e3 --- /dev/null +++ b/services/migrations/testdata/gitea/breaking_conditions/GET_%2Fapi%2Fv1%2Fversion @@ -0,0 +1,9 @@ +X-Frame-Options: SAMEORIGIN +Content-Length: 41 +Cache-Control: max-age=0, private, must-revalidate, no-transform +Content-Type: application/json;charset=utf-8 +Alt-Svc: h3=":443"; ma=2592000 +Vary: Origin +X-Content-Type-Options: nosniff + +{"version":"1.25.0+dev-376-g223205cc6b"}