forked from TrueCloudLab/frostfs-api-go
[#168] storageGroup: Implement binary/JSON encoders/decoders on SG
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
6456fcf8fa
commit
55948c2ab1
4 changed files with 79 additions and 18 deletions
20
v2/storagegroup/json_test.go
Normal file
20
v2/storagegroup/json_test.go
Normal file
|
@ -0,0 +1,20 @@
|
|||
package storagegroup_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/storagegroup"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestStorageGroupJSON(t *testing.T) {
|
||||
sg := generateSG()
|
||||
|
||||
data, err := sg.MarshalJSON()
|
||||
require.NoError(t, err)
|
||||
|
||||
sg2 := new(storagegroup.StorageGroup)
|
||||
require.NoError(t, sg2.UnmarshalJSON(data))
|
||||
|
||||
require.Equal(t, sg, sg2)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue