mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-10-15 19:42:04 +00:00
chore: unbreak existing tests
Because the user:password is no longer automatically set as upstream origin, we have to set it manually if we want push to work.
This commit is contained in:
parent
9fb75a141d
commit
f7fb1226a4
5 changed files with 16 additions and 0 deletions
|
@ -105,6 +105,8 @@ func doGitClone(dstLocalPath string, u *url.URL) func(*testing.T) {
|
|||
exist, err := util.IsExist(filepath.Join(dstLocalPath, "README.md"))
|
||||
require.NoError(t, err)
|
||||
assert.True(t, exist)
|
||||
// Set user:password
|
||||
doGitSetRemoteURL(dstLocalPath, "origin", u)(t)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,6 +119,8 @@ func doPartialGitClone(dstLocalPath string, u *url.URL) func(*testing.T) {
|
|||
exist, err := util.IsExist(filepath.Join(dstLocalPath, "README.md"))
|
||||
require.NoError(t, err)
|
||||
assert.True(t, exist)
|
||||
// Set user:password
|
||||
doGitSetRemoteURL(dstLocalPath, "origin", u)(t)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,6 +166,14 @@ func doGitAddRemote(dstPath, remoteName string, u *url.URL) func(*testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func doGitSetRemoteURL(dstPath, remoteName string, u *url.URL) func(*testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Helper()
|
||||
_, _, err := git.NewCommand(git.DefaultContext, "remote", "set-url").AddDynamicArguments(remoteName, u.String()).RunStdString(&git.RunOpts{Dir: dstPath})
|
||||
require.NoError(t, err)
|
||||
}
|
||||
}
|
||||
|
||||
func doGitPushTestRepository(dstPath string, args ...string) func(*testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Helper()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue