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:
parent
3f7f977834
commit
9d8a740c6a
1 changed files with 11 additions and 8 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue