Skip to content

Commit

Permalink
Add test for blocked repository config
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Farries committed May 10, 2022
1 parent 762bbcc commit 9192c26
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion install/installer/pkg/components/server/configmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func TestConfigMap(t *testing.T) {
WorkspaceImage string
JWTSecret string
SessionSecret string
BlockedRepositories []experimental.BlockedRepository
GitHubApp experimental.GithubApp
}

Expand All @@ -39,6 +40,10 @@ func TestConfigMap(t *testing.T) {
WorkspaceImage: "some-workspace-image",
JWTSecret: "some-jwt-secret",
SessionSecret: "some-session-secret",
BlockedRepositories: []experimental.BlockedRepository{{
UrlRegExp: "https://github.com/some-user/some-bad-repo",
BlockUser: true,
}},
GitHubApp: experimental.GithubApp{
AppId: 123,
AuthProviderId: "some-auth-provider-id",
Expand Down Expand Up @@ -70,7 +75,8 @@ func TestConfigMap(t *testing.T) {
Session: experimental.Session{
Secret: expectation.SessionSecret,
},
GithubApp: &expectation.GitHubApp,
GithubApp: &expectation.GitHubApp,
BlockedRepositories: expectation.BlockedRepositories,
},
},
},
Expand Down Expand Up @@ -107,6 +113,16 @@ func TestConfigMap(t *testing.T) {
WorkspaceImage: config.WorkspaceDefaults.WorkspaceImage,
JWTSecret: config.OAuthServer.JWTSecret,
SessionSecret: config.Session.Secret,
BlockedRepositories: func(config ConfigSerialized) []experimental.BlockedRepository {
var blockedRepos []experimental.BlockedRepository
for _, repo := range config.BlockedRepositories {
blockedRepos = append(blockedRepos, experimental.BlockedRepository{
UrlRegExp: repo.UrlRegExp,
BlockUser: repo.BlockUser,
})
}
return blockedRepos
}(config),
GitHubApp: experimental.GithubApp{
AppId: config.GitHubApp.AppId,
AuthProviderId: config.GitHubApp.AuthProviderId,
Expand Down

0 comments on commit 9192c26

Please sign in to comment.