summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/option_requestedoption_test.go
diff options
context:
space:
mode:
authorChris Koch <chrisko@google.com>2019-12-28 02:44:19 -0800
committerinsomniac <insomniacslk@users.noreply.github.com>2020-03-05 15:51:55 +0000
commit3b6f190b53285624aaba864ca57892d3b2a2bec4 (patch)
tree3464a136e12ce57a95c01e94a6804758fba3fa24 /dhcpv6/option_requestedoption_test.go
parent20d19b1f0dd7e6c43af491199d8bd121d5c8a0c8 (diff)
v6: RequestedOptions getter
Signed-off-by: Chris Koch <chrisko@google.com>
Diffstat (limited to 'dhcpv6/option_requestedoption_test.go')
-rw-r--r--dhcpv6/option_requestedoption_test.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/dhcpv6/option_requestedoption_test.go b/dhcpv6/option_requestedoption_test.go
index 3e79480..9941a89 100644
--- a/dhcpv6/option_requestedoption_test.go
+++ b/dhcpv6/option_requestedoption_test.go
@@ -8,30 +8,33 @@ import (
func TestOptRequestedOption(t *testing.T) {
expected := []byte{0, 1, 0, 2}
- _, err := ParseOptRequestedOption(expected)
+ var o optRequestedOption
+ err := o.FromBytes(expected)
require.NoError(t, err, "ParseOptRequestedOption() correct options should not error")
}
func TestOptRequestedOptionParseOptRequestedOptionTooShort(t *testing.T) {
buf := []byte{0, 1, 0}
- _, err := ParseOptRequestedOption(buf)
+ var o optRequestedOption
+ err := o.FromBytes(buf)
require.Error(t, err, "A short option should return an error (must be divisible by 2)")
}
func TestOptRequestedOptionString(t *testing.T) {
buf := []byte{0, 1, 0, 2}
- opt, err := ParseOptRequestedOption(buf)
+ var o optRequestedOption
+ err := o.FromBytes(buf)
require.NoError(t, err)
require.Contains(
t,
- opt.String(),
+ o.String(),
"Client Identifier, Server Identifier",
"String() should contain the options specified",
)
- opt.AddRequestedOption(12345)
+ o.OptionCodes = append(o.OptionCodes, 12345)
require.Contains(
t,
- opt.String(),
+ o.String(),
"unknown",
"String() should contain 'Unknown' for an illegal option",
)