Files
services/streams/handler/token_test.go
2021-02-08 14:42:47 +00:00

28 lines
595 B
Go

package handler_test
import (
"context"
"testing"
pb "github.com/micro/services/streams/proto"
"github.com/stretchr/testify/assert"
)
func TestToken(t *testing.T) {
h := testHandler(t)
t.Run("WithoutTopic", func(t *testing.T) {
var rsp pb.TokenResponse
err := h.Token(context.TODO(), &pb.TokenRequest{}, &rsp)
assert.NoError(t, err)
assert.NotEmpty(t, rsp.Token)
})
t.Run("WithTopic", func(t *testing.T) {
var rsp pb.TokenResponse
err := h.Token(context.TODO(), &pb.TokenRequest{Topic: "helloworld"}, &rsp)
assert.NoError(t, err)
assert.NotEmpty(t, rsp.Token)
})
}