"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "internal/config/from_env_test.go" between
gh-cli-1.10.3.tar.gz and gh-cli-1.11.0.tar.gz

About: GitHub CLI is GitHub’s official command line tool.

from_env_test.go  (gh-cli-1.10.3):from_env_test.go  (gh-cli-1.11.0)
skipping to change at line 16 skipping to change at line 16
"github.com/MakeNowJust/heredoc" "github.com/MakeNowJust/heredoc"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
func TestInheritEnv(t *testing.T) { func TestInheritEnv(t *testing.T) {
orig_GITHUB_TOKEN := os.Getenv("GITHUB_TOKEN") orig_GITHUB_TOKEN := os.Getenv("GITHUB_TOKEN")
orig_GITHUB_ENTERPRISE_TOKEN := os.Getenv("GITHUB_ENTERPRISE_TOKEN") orig_GITHUB_ENTERPRISE_TOKEN := os.Getenv("GITHUB_ENTERPRISE_TOKEN")
orig_GH_TOKEN := os.Getenv("GH_TOKEN") orig_GH_TOKEN := os.Getenv("GH_TOKEN")
orig_GH_ENTERPRISE_TOKEN := os.Getenv("GH_ENTERPRISE_TOKEN") orig_GH_ENTERPRISE_TOKEN := os.Getenv("GH_ENTERPRISE_TOKEN")
orig_AppData := os.Getenv("AppData")
t.Cleanup(func() { t.Cleanup(func() {
os.Setenv("GITHUB_TOKEN", orig_GITHUB_TOKEN) os.Setenv("GITHUB_TOKEN", orig_GITHUB_TOKEN)
os.Setenv("GITHUB_ENTERPRISE_TOKEN", orig_GITHUB_ENTERPRISE_TOKEN ) os.Setenv("GITHUB_ENTERPRISE_TOKEN", orig_GITHUB_ENTERPRISE_TOKEN )
os.Setenv("GH_TOKEN", orig_GH_TOKEN) os.Setenv("GH_TOKEN", orig_GH_TOKEN)
os.Setenv("GH_ENTERPRISE_TOKEN", orig_GH_ENTERPRISE_TOKEN) os.Setenv("GH_ENTERPRISE_TOKEN", orig_GH_ENTERPRISE_TOKEN)
os.Setenv("AppData", orig_AppData)
}) })
type wants struct { type wants struct {
hosts []string hosts []string
token string token string
source string source string
writeable bool writeable bool
} }
tests := []struct { tests := []struct {
skipping to change at line 267 skipping to change at line 269
writeable: false, writeable: false,
}, },
}, },
} }
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
os.Setenv("GITHUB_TOKEN", tt.GITHUB_TOKEN) os.Setenv("GITHUB_TOKEN", tt.GITHUB_TOKEN)
os.Setenv("GITHUB_ENTERPRISE_TOKEN", tt.GITHUB_ENTERPRISE _TOKEN) os.Setenv("GITHUB_ENTERPRISE_TOKEN", tt.GITHUB_ENTERPRISE _TOKEN)
os.Setenv("GH_TOKEN", tt.GH_TOKEN) os.Setenv("GH_TOKEN", tt.GH_TOKEN)
os.Setenv("GH_ENTERPRISE_TOKEN", tt.GH_ENTERPRISE_TOKEN) os.Setenv("GH_ENTERPRISE_TOKEN", tt.GH_ENTERPRISE_TOKEN)
os.Setenv("AppData", "")
baseCfg := NewFromString(tt.baseConfig) baseCfg := NewFromString(tt.baseConfig)
cfg := InheritEnv(baseCfg) cfg := InheritEnv(baseCfg)
hosts, _ := cfg.Hosts() hosts, _ := cfg.Hosts()
assert.Equal(t, tt.wants.hosts, hosts) assert.Equal(t, tt.wants.hosts, hosts)
val, source, _ := cfg.GetWithSource(tt.hostname, "oauth_t oken") val, source, _ := cfg.GetWithSource(tt.hostname, "oauth_t oken")
assert.Equal(t, tt.wants.token, val) assert.Equal(t, tt.wants.token, val)
assert.Regexp(t, tt.wants.source, source) assert.Regexp(t, tt.wants.source, source)
 End of changes. 3 change blocks. 
0 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)