-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi_surface_test.go
More file actions
61 lines (56 loc) · 1.97 KB
/
Copy pathapi_surface_test.go
File metadata and controls
61 lines (56 loc) · 1.97 KB
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
package sanswitch_test
import (
"reflect"
"slices"
"testing"
sanswitch "github.com/everstarmy/sanswitch"
)
func TestPublicMethodSurface(t *testing.T) {
t.Parallel()
tests := []struct {
name string
typeOf reflect.Type
want []string
}{
{
name: "Client",
typeOf: reflect.TypeFor[*sanswitch.Client](),
want: []string{
"AbortZoneTransaction", "ActivateZoneConfig", "AuditLogs",
"BeginZoneTransaction", "Blades", "Capabilities", "ClockServer", "Close",
"CreateAlias", "CreateZone", "DefinedAliases", "DefinedConfigs", "DefinedZone",
"DefinedZones", "DeleteAlias", "DeleteZone", "EffectiveConfig", "EffectiveZones",
"ErrorLogs", "FDMIHBAs", "FDMIPorts", "FabricSwitches", "Fans",
"FibreChannelNameServers", "FibreChannelStatistics", "FirmwareHistory", "Hardware",
"HistoryLogs", "IsLoggedIn", "LogicalSwitches", "Login", "Logout", "MediaRDPs",
"Ports", "PowerSupplies", "RenameAlias", "RenameZone", "RetryCount", "SaveZoneConfig",
"Sensors", "SetLogOutput", "SetVFID", "SetVerbose", "SNMPSystem", "SNMPv1Accounts",
"SNMPv1Traps", "SNMPv3Accounts", "SNMPv3Traps", "Switch", "SwitchStatus",
"SystemResources", "Timeout", "TimeZone", "TrunkAreas", "TrunkPerformances", "Trunks",
"UpdateAlias", "UpdateDefinedConfig", "UpdateZone", "Version", "ZoneChecksum",
"ZoneDatabase", "ZoneTransactionStatus",
},
},
{
name: "ZoneTransaction",
typeOf: reflect.TypeFor[*sanswitch.ZoneTransaction](),
want: []string{
"Abort", "AddZoneToConfig", "Commit", "CreateZone", "DeleteZone",
"RemoveZoneFromConfig", "ReplaceZone",
},
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
t.Parallel()
got := make([]string, 0, test.typeOf.NumMethod())
for index := range test.typeOf.NumMethod() {
got = append(got, test.typeOf.Method(index).Name)
}
slices.Sort(test.want)
if !slices.Equal(got, test.want) {
t.Fatalf("public methods:\n got: %v\nwant: %v", got, test.want)
}
})
}
}