fix installer
This commit is contained in:
parent
46030a5b14
commit
c2091e746a
19 changed files with 264 additions and 73 deletions
29
internal/server/tenantauth_test.go
Normal file
29
internal/server/tenantauth_test.go
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/danyel/go-loose/internal/config"
|
||||
)
|
||||
|
||||
func TestRequestTenantSlug(t *testing.T) {
|
||||
server := &Server{cfg: config.Config{AuthDomain: "auth.dev"}}
|
||||
tests := []struct {
|
||||
host string
|
||||
want string
|
||||
}{
|
||||
{host: "auth.dev", want: ""},
|
||||
{host: "auth.dev:8080", want: ""},
|
||||
{host: "nmbs.auth.dev", want: "nmbs"},
|
||||
{host: "NMBS.auth.dev:8080", want: "nmbs"},
|
||||
{host: "nested.nmbs.auth.dev", want: ""},
|
||||
{host: "localhost:8080", want: ""},
|
||||
}
|
||||
for _, test := range tests {
|
||||
t.Run(test.host, func(t *testing.T) {
|
||||
if got := server.requestTenantSlug(test.host); got != test.want {
|
||||
t.Fatalf("requestTenantSlug(%q) = %q, want %q", test.host, got, test.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue