File tree 1 file changed +34
-0
lines changed
1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,40 @@ func TestExternalAuth(t *testing.T) {
36
36
37
37
attribs := resource .Primary .Attributes
38
38
require .Equal (t , "github" , attribs ["id" ])
39
+ require .Equal (t , "" , attribs ["optional" ])
40
+
41
+ return nil
42
+ },
43
+ }},
44
+ })
45
+ }
46
+
47
+ func TestOptionalExternalAuth (t * testing.T ) {
48
+ t .Parallel ()
49
+
50
+ resource .Test (t , resource.TestCase {
51
+ Providers : map [string ]* schema.Provider {
52
+ "coder" : provider .New (),
53
+ },
54
+ IsUnitTest : true ,
55
+ Steps : []resource.TestStep {{
56
+ Config : `
57
+ provider "coder" {
58
+ }
59
+ data "coder_external_auth" "github" {
60
+ id = "github"
61
+ optional = true
62
+ }
63
+ ` ,
64
+ Check : func (state * terraform.State ) error {
65
+ require .Len (t , state .Modules , 1 )
66
+ require .Len (t , state .Modules [0 ].Resources , 1 )
67
+ resource := state .Modules [0 ].Resources ["data.coder_external_auth.github" ]
68
+ require .NotNil (t , resource )
69
+
70
+ attribs := resource .Primary .Attributes
71
+ require .Equal (t , "github" , attribs ["id" ])
72
+ require .Equal (t , "true" , attribs ["optional" ])
39
73
40
74
return nil
41
75
},
You can’t perform that action at this time.
0 commit comments