summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/dhcpv6message_test.go
diff options
context:
space:
mode:
authorinsomniac <insomniacslk@users.noreply.github.com>2018-08-13 10:39:40 +0100
committerGitHub <noreply@github.com>2018-08-13 10:39:40 +0100
commitb773f618967811e235b334516b0c40563c3a1464 (patch)
tree75676531481c1e0a4f00fa8210178e35ca74f168 /dhcpv6/dhcpv6message_test.go
parenta6212f1f72e94821a29894fb66656a981bd035d0 (diff)
parent79d05d5ba9ac8fb488fc6aa1692366d933dee3e1 (diff)
add IsOptionRequested (#122)
Diffstat (limited to 'dhcpv6/dhcpv6message_test.go')
-rw-r--r--dhcpv6/dhcpv6message_test.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/dhcpv6/dhcpv6message_test.go b/dhcpv6/dhcpv6message_test.go
new file mode 100644
index 0000000..5c92a7b
--- /dev/null
+++ b/dhcpv6/dhcpv6message_test.go
@@ -0,0 +1,34 @@
+package dhcpv6
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/require"
+)
+
+func TestIsNetboot(t *testing.T) {
+ msg1 := DHCPv6Message{}
+ require.False(t, msg1.IsNetboot())
+
+ msg2 := DHCPv6Message{}
+ optro := OptRequestedOption{}
+ optro.AddRequestedOption(OptionBootfileURL)
+ msg2.AddOption(&optro)
+ require.True(t, msg2.IsNetboot())
+
+ msg3 := DHCPv6Message{}
+ optbf := OptBootFileURL{}
+ msg3.AddOption(&optbf)
+ require.True(t, msg3.IsNetboot())
+}
+
+func TestIsOptionRequested(t *testing.T) {
+ msg1 := DHCPv6Message{}
+ require.False(t, msg1.IsOptionRequested(OptionDNSRecursiveNameServer))
+
+ msg2 := DHCPv6Message{}
+ optro := OptRequestedOption{}
+ optro.AddRequestedOption(OptionDNSRecursiveNameServer)
+ msg2.AddOption(&optro)
+ require.True(t, msg2.IsOptionRequested(OptionDNSRecursiveNameServer))
+}