[#189] sdk/netmap: Implement NodeAttribute type

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-05 14:39:50 +03:00 committed by Alex Vanin
parent d4f5c27d47
commit 6347f846eb
2 changed files with 92 additions and 0 deletions

View file

@ -42,3 +42,41 @@ func TestNodeStateFromV2(t *testing.T) {
require.Equal(t, item.sV2, item.s.ToV2())
}
}
func TestNodeAttributeFromV2(t *testing.T) {
aV2 := new(netmap.Attribute)
aV2.SetKey("key")
aV2.SetValue("value")
aV2.SetParents([]string{"par1", "par2"})
a := NewNodeAttributeFromV2(aV2)
require.Equal(t, aV2, a.ToV2())
}
func TestNodeAttribute_Key(t *testing.T) {
a := NewNodeAttribute()
key := "some key"
a.SetKey(key)
require.Equal(t, key, a.Key())
}
func TestNodeAttribute_Value(t *testing.T) {
a := NewNodeAttribute()
val := "some value"
a.SetValue(val)
require.Equal(t, val, a.Value())
}
func TestNodeAttribute_ParentKeys(t *testing.T) {
a := NewNodeAttribute()
keys := []string{"par1", "par2"}
a.SetParentKeys(keys...)
require.Equal(t, keys, a.ParentKeys())
}