Documentation ¶
Index ¶
- Constants
- func GenerateTestClaims(t *testing.T) *jwtpb.JWTClaims
- func GenerateTestClaimsWithDuration(t *testing.T, duration time.Duration, email string) *jwtpb.JWTClaims
- func GenerateTestClaimsWithEmail(t *testing.T, email string) *jwtpb.JWTClaims
- func GenerateTestJWTToken(t *testing.T, signingKey string) string
- func GenerateTestJWTTokenWithDuration(t *testing.T, signingKey string, timeout time.Duration) string
- func GenerateTestServiceClaims(t *testing.T, service string) *jwtpb.JWTClaims
- func MustStartTestNATS(t *testing.T) (*nats.Conn, func())
- func NewMockGCSClient(buckets map[string]*MockGCSBucket) stiface.Client
- func SetupEtcd() (*clientv3.Client, func(), error)
- func SignPBClaims(t *testing.T, claims *jwtpb.JWTClaims, signingKey string) string
- type MockContext
- type MockGCSBucket
- type MockGCSBucketHandle
- type MockGCSClient
- type MockGCSObject
- type MockGCSObjectHandle
Constants ¶
const TestOrgID string = "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
TestOrgID is a test org valid UUID
const TestUserID string = "7ba7b810-9dad-11d1-80b4-00c04fd430c8"
TestUserID is a test user valid UUID
Variables ¶
This section is empty.
Functions ¶
func GenerateTestClaims ¶
GenerateTestClaims generates valid test user claims valid for 60 minutes
func GenerateTestClaimsWithDuration ¶
func GenerateTestClaimsWithDuration(t *testing.T, duration time.Duration, email string) *jwtpb.JWTClaims
GenerateTestClaimsWithDuration generates valid test user claims for a specified duration.
func GenerateTestClaimsWithEmail ¶
GenerateTestClaimsWithEmail generates valid test user claims for the given email.
func GenerateTestJWTToken ¶
GenerateTestJWTToken generates valid tokens for testing.
func GenerateTestJWTTokenWithDuration ¶
func GenerateTestJWTTokenWithDuration(t *testing.T, signingKey string, timeout time.Duration) string
GenerateTestJWTTokenWithDuration generates valid tokens for testing with the specified duration.
func GenerateTestServiceClaims ¶
GenerateTestServiceClaims generates valid test service claims for a specified duration.
func MustStartTestNATS ¶
MustStartTestNATS starts up a NATS server at an open port.
func NewMockGCSClient ¶
func NewMockGCSClient(buckets map[string]*MockGCSBucket) stiface.Client
NewMockGCSClient creates a new mock client for GCS.
Types ¶
type MockContext ¶
type MockContext struct{}
MockContext provides a mock context for testing.
func (MockContext) Deadline ¶
func (ctx MockContext) Deadline() (time.Time, bool)
Deadline returns the deadline for the mock context.
func (MockContext) Done ¶
func (ctx MockContext) Done() <-chan struct{}
Done returns the done channel for the mock context.
func (MockContext) Err ¶
func (ctx MockContext) Err() error
Err returns the error for the mock context.
func (MockContext) Value ¶
func (ctx MockContext) Value(key interface{}) interface{}
Value returns the value for the mock context.
type MockGCSBucket ¶
type MockGCSBucket struct {
// contains filtered or unexported fields
}
MockGCSBucket is a mock of a GCS storage bucket.
func NewMockGCSBucket ¶
func NewMockGCSBucket(objects map[string]*MockGCSObject, attrs *storage.BucketAttrs) *MockGCSBucket
NewMockGCSBucket creates a new mock bucket for GCS.
type MockGCSBucketHandle ¶
type MockGCSBucketHandle struct { stiface.BucketHandle // contains filtered or unexported fields }
MockGCSBucketHandle is a mock of GCS storage client's BucketHandle.
func (MockGCSBucketHandle) Object ¶
func (b MockGCSBucketHandle) Object(name string) stiface.ObjectHandle
Object returns object handle from the given path.
type MockGCSClient ¶
MockGCSClient is a mock of GCS's storage client.
func (*MockGCSClient) Bucket ¶
func (c *MockGCSClient) Bucket(name string) stiface.BucketHandle
Bucket gets a mock gcs bucket.
type MockGCSObject ¶
type MockGCSObject struct {
// contains filtered or unexported fields
}
MockGCSObject is a mock of a GCS object, storing contents and attrs.
func NewMockGCSObject ¶
func NewMockGCSObject(contents []byte, attrs *storage.ObjectAttrs) *MockGCSObject
NewMockGCSObject creates a new mock GCS object.
type MockGCSObjectHandle ¶
type MockGCSObjectHandle struct { stiface.ObjectHandle // contains filtered or unexported fields }
MockGCSObjectHandle is a mock of GCS storage client's ObjectHandle.
func (MockGCSObjectHandle) Attrs ¶
func (o MockGCSObjectHandle) Attrs(context.Context) (*storage.ObjectAttrs, error)
Attrs returns a new Mocked attrs object.