terraform/command/command_test.go

40 lines
847 B
Go
Raw Normal View History

2014-06-19 06:36:44 +02:00
package command
import (
"path/filepath"
"github.com/hashicorp/terraform/terraform"
)
// This is the directory where our test fixtures are.
const fixtureDir = "./test-fixtures"
func testFixturePath(name string) string {
return filepath.Join(fixtureDir, name, "main.tf")
}
func testTFConfig(p terraform.ResourceProvider) *terraform.Config {
return &terraform.Config{
Providers: map[string]terraform.ResourceProviderFactory{
"test": func() (terraform.ResourceProvider, error) {
return p, nil
},
},
}
}
func testProvider() *terraform.MockResourceProvider {
p := new(terraform.MockResourceProvider)
p.RefreshFn = func(
s *terraform.ResourceState) (*terraform.ResourceState, error) {
return s, nil
}
2014-06-19 06:36:44 +02:00
p.ResourcesReturn = []terraform.ResourceType{
terraform.ResourceType{
Name: "test_instance",
},
}
return p
}