forked from TrueCloudLab/frostfs-api-go
[#168] session: Implement binary/JSON encoders/decoders on SessionContext
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
93df2fd765
commit
86351a8f90
4 changed files with 61 additions and 4 deletions
20
v2/session/json_test.go
Normal file
20
v2/session/json_test.go
Normal file
|
@ -0,0 +1,20 @@
|
|||
package session_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/session"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestChecksumJSON(t *testing.T) {
|
||||
ctx := generateObjectCtx("id")
|
||||
|
||||
data, err := ctx.MarshalJSON()
|
||||
require.NoError(t, err)
|
||||
|
||||
ctx2 := new(session.ObjectSessionContext)
|
||||
require.NoError(t, ctx2.UnmarshalJSON(data))
|
||||
|
||||
require.Equal(t, ctx, ctx2)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue