MCPcopy
hub / github.com/cli/cli / TestTenantName

Function TestTenantName

internal/ghinstance/host_test.go:9–49  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestTenantName(t *testing.T) {
10 tests := []struct {
11 host string
12 wantTenant string
13 wantFound bool
14 }{
15 {
16 host: "github.com",
17 wantTenant: "github.com",
18 },
19 {
20 host: "github.localhost",
21 wantTenant: "github.localhost",
22 },
23 {
24 host: "garage.github.com",
25 wantTenant: "github.com",
26 },
27 {
28 host: "ghe.com",
29 wantTenant: "ghe.com",
30 },
31 {
32 host: "tenant.ghe.com",
33 wantTenant: "tenant",
34 wantFound: true,
35 },
36 {
37 host: "api.tenant.ghe.com",
38 wantTenant: "tenant",
39 wantFound: true,
40 },
41 }
42 for _, tt := range tests {
43 t.Run(tt.host, func(t *testing.T) {
44 if tenant, found := TenantName(tt.host); tenant != tt.wantTenant || found != tt.wantFound {
45 t.Errorf("TenantName(%v) = %v %v, want %v %v", tt.host, tenant, found, tt.wantTenant, tt.wantFound)
46 }
47 })
48 }
49}
50
51func TestHostnameValidator(t *testing.T) {
52 tests := []struct {

Callers

nothing calls this directly

Calls 3

TenantNameFunction · 0.85
RunMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected