core: Fix TestContext2Refresh_dataState

Now that we fetch schemas during NewContext, we need to configure the
mock GetSchema method before constructing the context.
This commit is contained in:
Martin Atkins 2018-06-01 14:52:27 -07:00
parent df2907abb9
commit 432331e484
1 changed files with 12 additions and 10 deletions

View File

@ -877,8 +877,8 @@ func TestContext2Refresh_dataOrphan(t *testing.T) {
}
func TestContext2Refresh_dataState(t *testing.T) {
p := testProvider("null")
m := testModule(t, "refresh-data-resource-basic")
state := &State{
Modules: []*ModuleState{
&ModuleState{
@ -890,16 +890,8 @@ func TestContext2Refresh_dataState(t *testing.T) {
},
},
}
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
"null": testProviderFuncFixed(p),
},
),
State: state,
})
p := testProvider("null")
p.GetSchemaReturn = &ProviderSchema{
Provider: &configschema.Block{},
DataSources: map[string]*configschema.Block{
@ -914,6 +906,16 @@ func TestContext2Refresh_dataState(t *testing.T) {
},
}
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: ResourceProviderResolverFixed(
map[string]ResourceProviderFactory{
"null": testProviderFuncFixed(p),
},
),
State: state,
})
p.ReadDataDiffFn = nil
p.ReadDataDiffReturn = &InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{