summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/dhcpv6message_test.go
blob: 5c92a7b3c917e4841e414b8c7a8f031f5ccf5521 (plain)
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
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))
}