-
Notifications
You must be signed in to change notification settings - Fork 7
/
structure_password_policy_connected_services_test.go
87 lines (79 loc) · 2.08 KB
/
structure_password_policy_connected_services_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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package main
import (
"reflect"
"testing"
)
var (
testConnectedServicesConf []*ConnectedServices
testConnectedServicesInterface []interface{}
)
func init() {
testConnectedServicesConf = []*ConnectedServices{
{
ID: "123",
ExternalID: "123abc",
Name: "some name",
AppCount: 1,
SupportsPasswordSetDate: false,
},
{
ID: "456",
ExternalID: "456abc",
Name: "some other name",
AppCount: 1,
SupportsPasswordSetDate: false,
},
}
testConnectedServicesInterface = []interface{}{
map[string]interface{}{
"id": "123",
"external_id": "123abc",
"name": "some name",
"app_count": 1,
"supports_password_set_date": false,
},
map[string]interface{}{
"id": "456",
"external_id": "456abc",
"name": "some other name",
"app_count": 1,
"supports_password_set_date": false,
},
}
}
func TestFlattenPasswordPolicyConnectedServices(t *testing.T) {
cases := []struct {
Input []*ConnectedServices
ExpectedOutput []interface{}
}{
{
testConnectedServicesConf,
testConnectedServicesInterface,
},
}
for _, tc := range cases {
output := flattenPasswordPolicyConnectedServices(tc.Input)
if !reflect.DeepEqual(output, tc.ExpectedOutput) {
t.Fatalf("Unexpected output from flattener.\nExpected: %#v\nGiven: %#v",
tc.ExpectedOutput, output)
}
}
}
func TestExpandPasswordPolicyConnectedServices(t *testing.T) {
cases := []struct {
Input []interface{}
ExpectedOutput []*ConnectedServices
}{
{
testConnectedServicesInterface,
testConnectedServicesConf,
},
}
for _, tc := range cases {
output := expandPasswordPolicyConnectedServices(tc.Input)
if !reflect.DeepEqual(output, tc.ExpectedOutput) {
t.Fatalf("Unexpected output from expander.\nExpected: %#v\nGiven: %#v",
tc.ExpectedOutput, output)
}
}
}