diff options
author | Pablo Mazzini <pmazzini@gmail.com> | 2018-06-11 11:42:13 +0100 |
---|---|---|
committer | insomniac <insomniacslk@users.noreply.github.com> | 2018-06-11 11:42:13 +0100 |
commit | 5717652a33b34ce6ee9a9e89602b4eb323cea4af (patch) | |
tree | 7698a35c230207836a0c2fd4900176cb1083ca34 /dhcpv6/dhcpv6_test.go | |
parent | 784b93fe8bb3034a7f75272d6259aca86fd710da (diff) |
add NewReplyFromRenew and NewReplyFromRebind (#72)
Diffstat (limited to 'dhcpv6/dhcpv6_test.go')
-rw-r--r-- | dhcpv6/dhcpv6_test.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/dhcpv6/dhcpv6_test.go b/dhcpv6/dhcpv6_test.go index ff89280..9f37def 100644 --- a/dhcpv6/dhcpv6_test.go +++ b/dhcpv6/dhcpv6_test.go @@ -116,5 +116,39 @@ func TestNewReplyFromRequest(t *testing.T) { require.Equal(t, rep.Type(), REPLY) } +func TestNewReplyFromRenew(t *testing.T) { + ren := DHCPv6Message{} + ren.SetMessage(RENEW) + ren.SetTransactionID(0xabcdef) + cid := OptClientId{} + ren.AddOption(&cid) + + rep, err := NewReplyFromRenew(&ren) + require.Error(t, err) + + sid := OptServerId{} + ren.AddOption(&sid) + rep, err = NewReplyFromRenew(&ren) + require.Equal(t, rep.(*DHCPv6Message).TransactionID(), ren.TransactionID()) + require.Equal(t, rep.Type(), REPLY) +} + +func TestNewReplyFromRebind(t *testing.T) { + reb := DHCPv6Message{} + reb.SetMessage(REPLY) + rep, err := NewReplyFromRebind(&reb) + require.Error(t, err) + + reb.SetMessage(REBIND) + reb.SetTransactionID(0xabcdef) + cid := OptClientId{} + reb.AddOption(&cid) + + rep, err = NewReplyFromRebind(&reb) + require.NoError(t, err) + require.Equal(t, rep.(*DHCPv6Message).TransactionID(), reb.TransactionID()) + require.Equal(t, rep.Type(), REPLY) +} + // TODO test NewSolicit // test String and Summary |