provider/azure: Remove obsolete tests

This commit is contained in:
James Nugent 2015-12-22 15:46:46 -05:00
parent 05983fde21
commit 8aa991cb5d
1 changed files with 8 additions and 38 deletions

View File

@ -127,50 +127,20 @@ func TestAzure_validateSettingsFile(t *testing.T) {
} }
func TestAzure_providerConfigure(t *testing.T) { func TestAzure_providerConfigure(t *testing.T) {
home, err := homedir.Dir() rp := Provider()
if err != nil { raw := map[string]interface{}{
t.Fatalf("Error fetching homedir: %s", err) "publish_settings": testAzurePublishSettingsStr,
} }
fh, err := ioutil.TempFile(home, "tf-test-home")
if err != nil {
t.Fatalf("Error creating homedir-based temporary file: %s", err)
}
defer os.Remove(fh.Name())
_, err = io.WriteString(fh, testAzurePublishSettingsStr) rawConfig, err := config.NewRawConfig(raw)
if err != nil { if err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
fh.Close()
r := strings.NewReplacer(home, "~") err = rp.Configure(terraform.NewResourceConfig(rawConfig))
homePath := r.Replace(fh.Name()) meta := rp.(*schema.Provider).Meta()
if meta == nil {
cases := []struct { t.Fatal("Expected metadata, got nil: err: %s", err)
SettingsFile string // String of XML or a path to an XML file
NilMeta bool // whether meta is expected to be nil
}{
{testAzurePublishSettingsStr, false},
{homePath, false},
}
for _, tc := range cases {
rp := Provider()
raw := map[string]interface{}{
"settings_file": tc.SettingsFile,
}
rawConfig, err := config.NewRawConfig(raw)
if err != nil {
t.Fatalf("err: %s", err)
}
err = rp.Configure(terraform.NewResourceConfig(rawConfig))
meta := rp.(*schema.Provider).Meta()
if (meta == nil) != tc.NilMeta {
t.Fatalf("expected NilMeta: %t, got meta: %#v, settings_file: %q",
tc.NilMeta, meta, tc.SettingsFile)
}
} }
} }