github.phpd.cn/hashicorp/packer@v1.3.2/builder/azure/common/vault_test.go (about) 1 package common 2 3 import ( 4 "net/url" 5 "testing" 6 ) 7 8 func TestVaultClientKeyVaultEndpoint(t *testing.T) { 9 u, _ := url.Parse("https://vault.azure.net") 10 testSubject := NewVaultClient(*u) 11 12 vaultUrl := testSubject.getVaultUrl("my") 13 if vaultUrl != "https://my.vault.azure.net/" { 14 t.Errorf("expected \"https://my.vault.azure.net/\", got %q", vaultUrl) 15 } 16 } 17 18 func TestVaultClientKeyVaultEndpointPreserveScheme(t *testing.T) { 19 u, _ := url.Parse("http://vault.azure.net") 20 testSubject := NewVaultClient(*u) 21 22 vaultUrl := testSubject.getVaultUrl("my") 23 if vaultUrl != "http://my.vault.azure.net/" { 24 t.Errorf("expected \"http://my.vault.azure.net/\", got %q", vaultUrl) 25 } 26 }