github.com/Unheilbar/quorum@v1.0.0/plugin/qlight/gateway_test.go (about) 1 package qlight 2 3 import ( 4 "context" 5 "testing" 6 7 "github.com/ConsenSys/quorum-qlight-token-manager-plugin-sdk-go/mock_proto" 8 "github.com/ConsenSys/quorum-qlight-token-manager-plugin-sdk-go/proto" 9 "github.com/golang/mock/gomock" 10 "github.com/stretchr/testify/assert" 11 ) 12 13 func TestPluginPingPong_Ping(t *testing.T) { 14 ctrl := gomock.NewController(t) 15 defer ctrl.Finish() 16 req := &proto.TokenRefresh_Request{ 17 CurrentToken: "arbitrary msg", 18 Psi: "psi", 19 } 20 mockClient := mock_proto.NewMockPluginQLightTokenRefresherClient(ctrl) 21 mockClient. 22 EXPECT(). 23 TokenRefresh(gomock.Any(), gomock.Eq(req)). 24 Return(&proto.TokenRefresh_Response{ 25 Token: "new token", 26 }, nil) 27 testObject := &PluginGateway{client: mockClient} 28 29 resp, err := testObject.TokenRefresh(context.Background(), "arbitrary msg", "psi") 30 31 assert.NoError(t, err) 32 assert.Equal(t, "new token", resp) 33 }