From 103a6cf2dbf9b1adb756a20e07097a9ea809c7bb Mon Sep 17 00:00:00 2001 From: James Bardin Date: Thu, 8 Oct 2020 13:52:04 -0400 Subject: [PATCH] update mock provider call --- backend/local/backend_refresh_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/local/backend_refresh_test.go b/backend/local/backend_refresh_test.go index 7d96b971b..cb6cb9b4f 100644 --- a/backend/local/backend_refresh_test.go +++ b/backend/local/backend_refresh_test.go @@ -79,12 +79,13 @@ func TestLocal_refreshInput(t *testing.T) { p.ReadResourceResponse = providers.ReadResourceResponse{NewState: cty.ObjectVal(map[string]cty.Value{ "id": cty.StringVal("yes"), })} - p.ConfigureFn = func(c *terraform.ResourceConfig) error { - if v, ok := c.Get("value"); !ok || v != "bar" { - return fmt.Errorf("no value set") + p.ConfigureFn = func(req providers.ConfigureRequest) (resp providers.ConfigureResponse) { + val := req.Config.GetAttr("value") + if val.IsNull() || val.AsString() != "bar" { + resp.Diagnostics = resp.Diagnostics.Append(fmt.Errorf("incorrect value %#v", val)) } - return nil + return } // Enable input asking since it is normally disabled by default