frostfs-api-go/rpc/common/call_test.go
Leonard Lyubich 25da5d2e13 Add v2 version to go module name
Replace all elements from `v2` to root directory.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-11-17 15:29:33 +03:00

49 lines
1.3 KiB
Go

package common_test
import (
"testing"
"github.com/nspcc-dev/neofs-api-go/v2/rpc/common"
"github.com/stretchr/testify/require"
)
const (
testServiceName = "test service"
testRPCName = "test RPC"
)
func TestCallMethodInfoUnary(t *testing.T) {
i := common.CallMethodInfoUnary(testServiceName, testRPCName)
require.Equal(t, testServiceName, i.Service)
require.Equal(t, testRPCName, i.Name)
require.False(t, i.ClientStream())
require.False(t, i.ServerStream())
}
func TestCallMethodInfoServerStream(t *testing.T) {
i := common.CallMethodInfoServerStream(testServiceName, testRPCName)
require.Equal(t, testServiceName, i.Service)
require.Equal(t, testRPCName, i.Name)
require.False(t, i.ClientStream())
require.True(t, i.ServerStream())
}
func TestCallMethodInfoClientStream(t *testing.T) {
i := common.CallMethodInfoClientStream(testServiceName, testRPCName)
require.Equal(t, testServiceName, i.Service)
require.Equal(t, testRPCName, i.Name)
require.True(t, i.ClientStream())
require.False(t, i.ServerStream())
}
func TestCallMethodInfoBidirectionalStream(t *testing.T) {
i := common.CallMethodInfoBidirectionalStream(testServiceName, testRPCName)
require.Equal(t, testServiceName, i.Service)
require.Equal(t, testRPCName, i.Name)
require.True(t, i.ClientStream())
require.True(t, i.ServerStream())
}