зеркало из https://github.com/mislav/hub.git
Fix test failure due to test configs
This commit is contained in:
Родитель
65bdca152a
Коммит
7c9a6150af
|
@ -9,8 +9,7 @@ import (
|
|||
|
||||
func TestTransformCloneArgs(t *testing.T) {
|
||||
os.Setenv("GH_PROTOCOL", "git")
|
||||
|
||||
github.CreateTestConfig("jingweno", "123")
|
||||
github.CreateTestConfigs("jingweno", "123")
|
||||
|
||||
args := NewArgs([]string{"clone", "foo/gh"})
|
||||
transformCloneArgs(args)
|
||||
|
@ -28,7 +27,7 @@ func TestTransformCloneArgs(t *testing.T) {
|
|||
transformCloneArgs(args)
|
||||
|
||||
assert.Equal(t, 1, args.ParamsSize())
|
||||
assert.Equal(t, "git@github.com:jingweno/gh.git", args.FirstParam())
|
||||
assert.Equal(t, "git://github.com/jingweno/gh.git", args.FirstParam())
|
||||
|
||||
args = NewArgs([]string{"clone", "-p", "acl-services/devise-acl"})
|
||||
transformCloneArgs(args)
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"github.com/howeyc/gopass"
|
||||
"github.com/jingweno/gh/utils"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
|
@ -133,3 +134,15 @@ func CurrentConfigs() *Configs {
|
|||
|
||||
return &Configs{c}
|
||||
}
|
||||
|
||||
func CreateTestConfigs(user, token string) []Credentials {
|
||||
f, _ := ioutil.TempFile("", "test-config")
|
||||
defaultConfigsFile = f.Name()
|
||||
|
||||
c := []Credentials{
|
||||
{User: "jingweno", AccessToken: "123", Host: GitHubHost},
|
||||
}
|
||||
saveTo(f.Name(), &c)
|
||||
|
||||
return c
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче