Skip to content

Commit

Permalink
remove mostly-unimplemented support for GHE
Browse files Browse the repository at this point in the history
  • Loading branch information
dolph committed Apr 27, 2023
1 parent 289f324 commit a81fede
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
2 changes: 0 additions & 2 deletions cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ func Run(c *Config) {
defer wg.Done()
if source.URL != "" {
keyChan <- client.GetURL(source.URL)
} else if source.GHE.Hostname != "" {
keyChan <- client.GetGHE(source.GHE)
}
}(source)
}
Expand Down
3 changes: 1 addition & 2 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ type GithubEnterprise struct {
}

type Source struct {
URL string `yaml:"url"`
GHE GithubEnterprise `yaml:"github_enterprise"`
URL string `yaml:"url"`
}

type Config struct {
Expand Down
25 changes: 6 additions & 19 deletions config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ func TestConfigLoad(t *testing.T) {
// Test case: valid YAML content
validYamlContent := `
sources:
- url: "https://example.com/keys"
- github_enterprise:
api_hostname: "github.example.com"
user: "testuser"
token: "testtoken"
- url: https://example.com/keys
`
tmpFile, cleanup := createTempConfig(t, validYamlContent)
defer cleanup()
Expand All @@ -44,13 +40,6 @@ sources:

expectedSources := []Source{
{URL: "https://example.com/keys"},
{
GHE: GithubEnterprise{
Hostname: "github.example.com",
Username: "testuser",
Token: "testtoken",
},
},
}

if len(config.Sources) != len(expectedSources) {
Expand All @@ -63,14 +52,12 @@ sources:
}
}

// Test case: invalid YAML content
// Test case: invalid YAML content using a dict of sources instead of a
// list
invalidYamlContent := `
---
sources:
- url: "https://example.com/keys"
- github_enterprise:
api_hostname: "github.example.com"
user: "testuser"
token: "testtoken
url: https://example.com/keys
`
tmpFile, cleanup = createTempConfig(t, invalidYamlContent)
defer cleanup()
Expand All @@ -83,6 +70,6 @@ sources:
config.LoadConfigByPath(tmpFilePath)

if len(config.Sources) != 0 {
t.Errorf("Expected 0 sources, got %d", len(config.Sources))
t.Errorf("Expected 0 sources, got %d: %v", len(config.Sources), config.Sources[0])
}
}

0 comments on commit a81fede

Please sign in to comment.