test creating an updater when token is not set

This commit is contained in:
rhysd 2018-02-06 14:01:43 +09:00
parent 2bc49bb7b5
commit a384a5b5c8
1 changed files with 12 additions and 0 deletions

View File

@ -19,6 +19,18 @@ func TestGitHubTokenEnv(t *testing.T) {
}
}
func TestGitHubTokenIsNotSet(t *testing.T) {
token := os.Getenv("GITHUB_TOKEN")
if token != "" {
defer os.Setenv("GITHUB_TOKEN", token)
}
os.Setenv("GITHUB_TOKEN", "")
_ = DefaultUpdater()
if _, err := NewUpdater(Config{}); err != nil {
t.Error("Failed to initialize updater with empty config")
}
}
func TestGitHubEnterpriseClient(t *testing.T) {
url := "https://github.company.com/api/v3/"
up, err := NewUpdater(Config{APIToken: "hogehoge", EnterpriseBaseURL: url})