mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-28 18:06:34 +02:00
* rename cache folder * rename cache service everywhere * skip yaml in examples * Update docs/docs/topics/data-storage.md Co-authored-by: Travis Groth <travisgroth@users.noreply.github.com> Co-authored-by: Travis Groth <travisgroth@users.noreply.github.com>
119 lines
2.7 KiB
Go
119 lines
2.7 KiB
Go
package config
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func Test_isValidService(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
service string
|
|
want bool
|
|
}{
|
|
{"proxy", "proxy", true},
|
|
{"all", "all", true},
|
|
{"authenticate", "authenticate", true},
|
|
{"authenticate bad case", "AuThenticate", false},
|
|
{"authorize implemented", "authorize", true},
|
|
{"jiberish", "xd23", false},
|
|
{"databroker", "databroker", true},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := IsValidService(tt.service); got != tt.want {
|
|
t.Errorf("isValidService() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func Test_isAuthenticate(t *testing.T) {
|
|
t.Parallel()
|
|
tests := []struct {
|
|
name string
|
|
service string
|
|
want bool
|
|
}{
|
|
{"proxy", "proxy", false},
|
|
{"all", "all", true},
|
|
{"authenticate", "authenticate", true},
|
|
{"authenticate bad case", "AuThenticate", false},
|
|
{"authorize implemented", "authorize", false},
|
|
{"jiberish", "xd23", false},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := IsAuthenticate(tt.service); got != tt.want {
|
|
t.Errorf("isAuthenticate() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func Test_isAuthorize(t *testing.T) {
|
|
t.Parallel()
|
|
tests := []struct {
|
|
name string
|
|
service string
|
|
want bool
|
|
}{
|
|
{"proxy", "proxy", false},
|
|
{"all", "all", true},
|
|
{"authorize", "authorize", true},
|
|
{"authorize bad case", "AuThorize", false},
|
|
{"authenticate implemented", "authenticate", false},
|
|
{"jiberish", "xd23", false},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := IsAuthorize(tt.service); got != tt.want {
|
|
t.Errorf("isAuthenticate() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func Test_IsProxy(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
service string
|
|
want bool
|
|
}{
|
|
{"proxy", "proxy", true},
|
|
{"all", "all", true},
|
|
{"authorize", "authorize", false},
|
|
{"proxy bad case", "PrOxY", false},
|
|
{"jiberish", "xd23", false},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := IsProxy(tt.service); got != tt.want {
|
|
t.Errorf("IsProxy() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func Test_IsDataBroker(t *testing.T) {
|
|
t.Parallel()
|
|
tests := []struct {
|
|
name string
|
|
service string
|
|
want bool
|
|
}{
|
|
{"proxy", "proxy", false},
|
|
{"all", "all", true},
|
|
{"authorize", "authorize", false},
|
|
{"proxy bad case", "PrOxY", false},
|
|
{"jiberish", "xd23", false},
|
|
{"cache", "cache", true},
|
|
{"databroker", "databroker", true},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := IsDataBroker(tt.service); got != tt.want {
|
|
t.Errorf("IsDataBroker() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|