[#243] core/object: Replace test content of tombstone with an API structure

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-12-11 11:03:27 +03:00 committed by Alex Vanin
parent 4f5d5c7e45
commit 510e9ff2ec
7 changed files with 30 additions and 234 deletions

View file

@ -108,28 +108,25 @@ func TestFormatValidator_Validate(t *testing.T) {
obj := NewRaw()
obj.SetType(object.TypeTombstone)
require.Error(t, v.ValidateContent(obj.Object().SDK()))
require.Error(t, v.ValidateContent(obj.Object()))
addr := object.NewAddress()
content := object.NewTombstone()
content.SetMembers([]*object.ID{nil})
content := NewTombstoneContent()
content.SetAddressList(addr)
data, err := content.MarshalBinary()
data, err := content.Marshal()
require.NoError(t, err)
obj.SetPayload(data)
require.Error(t, v.ValidateContent(obj.Object().SDK()))
require.Error(t, v.ValidateContent(obj.Object()))
addr.SetContainerID(testContainerID(t))
addr.SetObjectID(testObjectID(t))
content.SetMembers([]*object.ID{testObjectID(t)})
data, err = content.MarshalBinary()
data, err = content.Marshal()
require.NoError(t, err)
obj.SetPayload(data)
require.NoError(t, v.ValidateContent(obj.Object().SDK()))
require.NoError(t, v.ValidateContent(obj.Object()))
})
}