fix: use mocked HTTP server for authorized migration

Skip it, as the mocked HTTP responses does not look sufficient to run
this test.
This commit is contained in:
Gusted 2025-08-26 21:57:25 +02:00
commit 9d8a740c6a
No known key found for this signature in database
GPG key ID: FD821B732837125F

View file

@ -4,7 +4,6 @@
package migrations
import (
"fmt"
"net/url"
"os"
"strings"
@ -456,25 +455,29 @@ func TestPagureDownloadRepoWithPublicIssues(t *testing.T) {
}
func TestPagureDownloadRepoWithPrivateIssues(t *testing.T) {
t.Skip("Does not work")
// Skip tests if Pagure token is not found
cloneUser := os.Getenv("PAGURE_CLONE_USER")
clonePassword := os.Getenv("PAGURE_CLONE_PASSWORD")
apiUser := os.Getenv("PAGURE_API_USER")
apiPassword := os.Getenv("PAGURE_API_TOKEN")
if apiUser == "" || apiPassword == "" {
t.Skip("skipped test because a PAGURE_ variable was not in the environment")
}
cloneAddr := fmt.Sprintf("https://%s:%s@pagure.io/protop2g-test-srce.git", cloneUser, clonePassword)
u, _ := url.Parse(cloneAddr)
fixtPath := "./testdata/pagure/full_download/authorized"
server := unittest.NewMockWebServer(t, "https://pagure.io", fixtPath, false)
defer server.Close()
serverURL, err := url.Parse(server.URL)
require.NoError(t, err)
if clonePassword != "" || cloneUser != "" {
serverURL.User = url.UserPassword(cloneUser, clonePassword)
}
serverURL.Path = "protop2g-test-srce.git"
cloneAddr := serverURL.String()
factory := &PagureDownloaderFactory{}
downloader, err := factory.New(t.Context(), base.MigrateOptions{
CloneAddr: u.String(),
CloneAddr: cloneAddr,
AuthUsername: apiUser,
AuthPassword: apiPassword,
AuthToken: apiPassword,