-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathresource_fake_test.go
47 lines (43 loc) · 923 Bytes
/
resource_fake_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package main
import (
"testing"
"github.com/hashicorp/terraform/helper/resource"
)
func TestAccFake__empty(t *testing.T) {
config := `
resource "fake" "test" {
value = ""
}
`
resource.Test(t, resource.TestCase{
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("fake.test", "id", "toto"),
resource.TestCheckResourceAttr("fake.test", "value", ""),
),
},
},
})
}
func TestAccFake__default_value(t *testing.T) {
config := `
resource "fake" "test" {
value = ""
}
`
resource.Test(t, resource.TestCase{
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("fake.test", "id", "toto"),
resource.TestCheckResourceAttr("fake.test", "value", "plop"),
),
},
},
})
}