diff options
author | Chris Koch <chrisko@google.com> | 2019-12-28 03:31:44 -0800 |
---|---|---|
committer | Chris K <c@chrisko.ch> | 2020-03-09 15:38:59 -0700 |
commit | a3af88f6782eba884ef5216b987bf4e2a96ff033 (patch) | |
tree | ae4402ecfd66c1fdcbbf8f3175cb90718de3dc29 /dhcpv6/option_interfaceid_test.go | |
parent | 817408d8cc264703a709f21d90ebe62c10a9b87c (diff) |
v6: getter for InterfaceID on RelayOptions
Signed-off-by: Chris Koch <chrisko@google.com>
Diffstat (limited to 'dhcpv6/option_interfaceid_test.go')
-rw-r--r-- | dhcpv6/option_interfaceid_test.go | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/dhcpv6/option_interfaceid_test.go b/dhcpv6/option_interfaceid_test.go index df2a762..45c1799 100644 --- a/dhcpv6/option_interfaceid_test.go +++ b/dhcpv6/option_interfaceid_test.go @@ -7,31 +7,24 @@ import ( "github.com/stretchr/testify/require" ) -func TestOptInterfaceId(t *testing.T) { +func TestParseOptInterfaceID(t *testing.T) { expected := []byte("DSLAM01 eth2/1/01/21") - opt, err := ParseOptInterfaceId(expected) + opt, err := parseOptInterfaceID(expected) if err != nil { t.Fatal(err) } - if url := opt.InterfaceID(); !bytes.Equal(url, expected) { + if url := opt.ID; !bytes.Equal(url, expected) { t.Fatalf("Invalid Interface ID. Expected %v, got %v", expected, url) } } -func TestOptInterfaceIdToBytes(t *testing.T) { - interfaceId := []byte("DSLAM01 eth2/1/01/21") - opt := OptInterfaceId{} - opt.SetInterfaceID(interfaceId) - toBytes := opt.ToBytes() - if !bytes.Equal(toBytes, interfaceId) { - t.Fatalf("Invalid ToBytes result. Expected %v, got %v", interfaceId, toBytes) +func TestOptInterfaceID(t *testing.T) { + want := []byte("DSLAM01 eth2/1/01/21") + opt := OptInterfaceID(want) + if got := opt.ToBytes(); !bytes.Equal(got, want) { + t.Fatalf("%s.ToBytes() = %v, want %v", opt, got, want) } -} -func TestOptInterfaceIdString(t *testing.T) { - interfaceId := []byte("DSLAM01 eth2/1/01/21") - opt := OptInterfaceId{} - opt.SetInterfaceID(interfaceId) require.Contains( t, opt.String(), |