mirror of
https://github.com/hanzoai/tasks.git
synced 2026-11-03 03:56:04 +00:00
Full module path rebrand from Temporal to Hanzo Tasks: - go.mod module: github.com/hanzoai/tasks - All internal Go imports updated (1906 files) - cmd/server renamed to cmd/tasksd - Binary name: tasksd (was temporal-server) - Docker images: hanzoai/tasks (was temporalio/server) - README rewritten with Hanzo Tasks branding - LLM.md created with integration notes - Makefile, goreleaser, CI workflows updated - go.temporal.io/sdk and go.temporal.io/api imports preserved (separate repos) Fork of Temporal.io (MIT license).
45 lines
1.1 KiB
Go
45 lines
1.1 KiB
Go
package authorization
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
"github.com/stretchr/testify/suite"
|
|
"github.com/hanzoai/tasks/common/config"
|
|
"go.uber.org/mock/gomock"
|
|
"google.golang.org/grpc"
|
|
)
|
|
|
|
type audienceMapperSuite struct {
|
|
suite.Suite
|
|
*require.Assertions
|
|
controller *gomock.Controller
|
|
}
|
|
|
|
func TestAudienceMapperSuite(t *testing.T) {
|
|
suite.Run(t, new(audienceMapperSuite))
|
|
}
|
|
|
|
func (s *audienceMapperSuite) SetupTest() {
|
|
s.Assertions = require.New(s.T())
|
|
s.controller = gomock.NewController(s.T())
|
|
}
|
|
|
|
func (s *audienceMapperSuite) TearDownTest() {
|
|
s.controller.Finish()
|
|
}
|
|
|
|
func (s *audienceMapperSuite) TestNewAudienceMapper_Static() {
|
|
mapper := NewAudienceMapper("foo-audience")
|
|
audience := mapper.Audience(context.Background(), nil, &grpc.UnaryServerInfo{})
|
|
s.Equal("foo-audience", audience)
|
|
}
|
|
|
|
func (s *audienceMapperSuite) TestGetAudienceMapperFromConfig() {
|
|
cfg := &config.Authorization{Audience: "bar-audience"}
|
|
mapper, _ := GetAudienceMapperFromConfig(cfg)
|
|
audience := mapper.Audience(context.Background(), nil, &grpc.UnaryServerInfo{})
|
|
s.Equal("bar-audience", audience)
|
|
}
|