core: use testProvider for TestContextImport_moduleProvider

This test depends on the Refresh callback that comes built in to a
provider returned from testProvider.
This commit is contained in:
Martin Atkins 2018-05-29 13:14:20 -07:00
parent 9c0335e22e
commit fc8030d2ae
1 changed files with 20 additions and 14 deletions

View File

@ -189,22 +189,18 @@ func TestContextImport_missingType(t *testing.T) {
}
func TestContextImport_moduleProvider(t *testing.T) {
p := mockProviderWithResourceTypeSchema("aws_instance", &configschema.Block{})
p.GetSchemaReturn.Provider = &configschema.Block{
p := testProvider("aws")
p.GetSchemaReturn = &ProviderSchema{
Provider: &configschema.Block{
Attributes: map[string]*configschema.Attribute{
"foo": {Type: cty.String, Optional: true},
},
}
m := testModule(t, "import-provider")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
"aws": testProviderFuncFixed(p),
},
),
})
ResourceTypes: map[string]*configschema.Block{
"aws_instance": {},
},
}
p.ImportStateReturn = []*InstanceState{
&InstanceState{
@ -224,6 +220,16 @@ func TestContextImport_moduleProvider(t *testing.T) {
return nil
}
m := testModule(t, "import-provider")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
"aws": testProviderFuncFixed(p),
},
),
})
state, diags := ctx.Import(&ImportOpts{
Config: m,
Targets: []*ImportTarget{