]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blob - vendor/github.com/hashicorp/terraform/helper/schema/testing.go
Upgrade to 0.12
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / hashicorp / terraform / helper / schema / testing.go
1 package schema
2
3 import (
4 "testing"
5
6 "github.com/hashicorp/terraform/config"
7 "github.com/hashicorp/terraform/terraform"
8 )
9
10 // TestResourceDataRaw creates a ResourceData from a raw configuration map.
11 func TestResourceDataRaw(
12 t *testing.T, schema map[string]*Schema, raw map[string]interface{}) *ResourceData {
13 t.Helper()
14
15 c, err := config.NewRawConfig(raw)
16 if err != nil {
17 t.Fatalf("err: %s", err)
18 }
19
20 sm := schemaMap(schema)
21 diff, err := sm.Diff(nil, terraform.NewResourceConfig(c), nil, nil, true)
22 if err != nil {
23 t.Fatalf("err: %s", err)
24 }
25
26 result, err := sm.Data(nil, diff)
27 if err != nil {
28 t.Fatalf("err: %s", err)
29 }
30
31 return result
32 }