File: dhcpv6message_test.go

package info (click to toggle)
golang-github-insomniacslk-dhcp 0.0~git20250417.5f8cf70-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid
  • size: 1,096 kB
  • sloc: makefile: 3
file content (30 lines) | stat: -rw-r--r-- 682 bytes parent folder | download | duplicates (3)
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
package dhcpv6

import (
	"testing"

	"github.com/stretchr/testify/require"
)

func TestIsNetboot(t *testing.T) {
	msg1 := Message{}
	require.False(t, msg1.IsNetboot())

	msg2 := Message{}
	msg2.AddOption(OptRequestedOption(OptionBootfileURL))
	require.True(t, msg2.IsNetboot())

	msg3 := Message{}
	optbf := OptBootFileURL("")
	msg3.AddOption(optbf)
	require.True(t, msg3.IsNetboot())
}

func TestIsOptionRequested(t *testing.T) {
	msg1 := Message{}
	require.False(t, msg1.IsOptionRequested(OptionDNSRecursiveNameServer))

	msg2 := Message{}
	msg2.AddOption(OptRequestedOption(OptionDNSRecursiveNameServer))
	require.True(t, msg2.IsOptionRequested(OptionDNSRecursiveNameServer))
}