pomerium/pkg/grpc/user/user_test.go
Caleb Doxsey c47055bece
upgrade to go v1.24 (#5562)
* upgrade to go v1.24

* add a macOS-specific //nolint comment too

---------

Co-authored-by: Kenneth Jenkins <51246568+kenjenkins@users.noreply.github.com>
2025-04-02 15:53:09 -06:00

29 lines
612 B
Go

package user
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
"google.golang.org/protobuf/types/known/timestamppb"
)
func TestServiceAccount_Validate(t *testing.T) {
t.Parallel()
t0 := timestamppb.New(time.Now().Add(-time.Second))
for _, tc := range []struct {
name string
serviceAccount *ServiceAccount
expect error
}{
{"valid", &ServiceAccount{}, nil},
{"expired", &ServiceAccount{ExpiresAt: t0}, ErrServiceAccountExpired},
} {
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
assert.ErrorIs(t, tc.serviceAccount.Validate(), tc.expect)
})
}
}