mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-25 01:00:16 -05:00
internal/legacy/helper/schema
moving helper/schema into the ineternal/legacy tree
This commit is contained in:
28
internal/legacy/helper/schema/testing.go
Normal file
28
internal/legacy/helper/schema/testing.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/internal/legacy/terraform"
|
||||
)
|
||||
|
||||
// TestResourceDataRaw creates a ResourceData from a raw configuration map.
|
||||
func TestResourceDataRaw(
|
||||
t *testing.T, schema map[string]*Schema, raw map[string]interface{}) *ResourceData {
|
||||
t.Helper()
|
||||
|
||||
c := terraform.NewResourceConfigRaw(raw)
|
||||
|
||||
sm := schemaMap(schema)
|
||||
diff, err := sm.Diff(nil, c, nil, nil, true)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
result, err := sm.Data(nil, diff)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user