helper/schema: test setting computed value and retrieving it via state

This commit is contained in:
Mitchell Hashimoto 2015-01-15 11:08:06 -08:00
parent 4d067f4d6d
commit 22436555a7
1 changed files with 31 additions and 0 deletions

View File

@ -2258,6 +2258,37 @@ func TestResourceDataState(t *testing.T) {
Attributes: map[string]string{},
},
},
// #22
{
Schema: map[string]*Schema{
"foo": &Schema{
Type: TypeString,
Optional: true,
Computed: true,
},
},
State: nil,
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"foo": &terraform.ResourceAttrDiff{
NewComputed: true,
},
},
},
Set: map[string]interface{}{
"foo": "bar",
},
Result: &terraform.InstanceState{
Attributes: map[string]string{
"foo": "bar",
},
},
},
}
for i, tc := range cases {