2017-12-31 05:26:17 +01:00
|
|
|
package data
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestNodeinfoBatAddresses(t *testing.T) {
|
|
|
|
assert := assert.New(t)
|
2017-12-05 23:17:49 +01:00
|
|
|
iface := &NetworkInterface{
|
2017-12-31 05:26:17 +01:00
|
|
|
Interfaces: struct {
|
|
|
|
Wireless []string `json:"wireless,omitempty"`
|
|
|
|
Other []string `json:"other,omitempty"`
|
|
|
|
Tunnel []string `json:"tunnel,omitempty"`
|
|
|
|
}{
|
|
|
|
Wireless: nil,
|
|
|
|
Other: []string{"aa:aa:aa:aa:aa", "aa:aa:aa:aa:ab"},
|
|
|
|
Tunnel: []string{},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2017-12-05 23:17:49 +01:00
|
|
|
addr := iface.Addresses()
|
2017-12-31 05:26:17 +01:00
|
|
|
assert.NotNil(addr)
|
|
|
|
assert.Equal([]string{"aa:aa:aa:aa:aa", "aa:aa:aa:aa:ab"}, addr)
|
|
|
|
}
|