aptestutil

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package aptestutil contains ActivityPub test utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewActivityID

func NewActivityID(id fmt.Stringer) *url.URL

NewActivityID returns a generated activity ID.

func NewMockAnchorEvent

func NewMockAnchorEvent(t *testing.T, anchorLink *linkset.Link) *vocab.AnchorEventType

NewMockAnchorEvent returns a new mock AnchorEvent.

func NewMockAnchorEventRef

func NewMockAnchorEventRef(t *testing.T) *vocab.AnchorEventType

NewMockAnchorEventRef returns a new mock AnchorEvent reference.

func NewMockAnchorLink(t *testing.T) *linkset.Link

NewMockAnchorLink returns a new mock anchor Link.

func NewMockAnnounceActivities

func NewMockAnnounceActivities(num int) []*vocab.ActivityType

NewMockAnnounceActivities returns the given number of mock 'Announce' activities.

func NewMockAnnounceActivity

func NewMockAnnounceActivity(actorIRI, toIRI *url.URL, obj *vocab.ObjectProperty) *vocab.ActivityType

NewMockAnnounceActivity returns a new mock Announce activity.

func NewMockCollection

func NewMockCollection(id, first, last *url.URL, totalItems int) *vocab.CollectionType

NewMockCollection returns a mock 'Collection' with the given ID and items.

func NewMockCollectionPage

func NewMockCollectionPage(id, next, prev, collID *url.URL, totalItems int,
	items ...*vocab.ObjectProperty) *vocab.CollectionPageType

NewMockCollectionPage returns a mock 'CollectionPage' with the given ID and items.

func NewMockCreateActivities

func NewMockCreateActivities(num int) []*vocab.ActivityType

NewMockCreateActivities returns the given number of mock 'Create' activities.

func NewMockCreateActivity

func NewMockCreateActivity(actorIRI, toIRI *url.URL, obj *vocab.ObjectProperty) *vocab.ActivityType

NewMockCreateActivity returns a new mock Create activity.

func NewMockLikeActivities

func NewMockLikeActivities(num int) []*vocab.ActivityType

NewMockLikeActivities returns the given number of mock 'Like' activities.

func NewMockLikeActivity

func NewMockLikeActivity(id, objID string) *vocab.ActivityType

NewMockLikeActivity returns a mock 'Like' activity.

func NewMockOrderedCollection

func NewMockOrderedCollection(id, first, last *url.URL, totalItems int) *vocab.OrderedCollectionType

NewMockOrderedCollection returns a mock 'OrderedCollection' with the given ID and items.

func NewMockOrderedCollectionPage

func NewMockOrderedCollectionPage(id, next, prev, collID *url.URL, totalItems int,
	items ...*vocab.ObjectProperty) *vocab.OrderedCollectionPageType

NewMockOrderedCollectionPage returns a mock 'OrderedCollectionPage' with the given ID and items.

func NewMockPublicKey

func NewMockPublicKey(serviceIRI *url.URL) *vocab.PublicKeyType

NewMockPublicKey returns a mock public key using the given service IRI.

func NewMockService

func NewMockService(serviceIRI *url.URL, opts ...ServiceOpt) *vocab.ActorType

NewMockService returns a mock 'Service' type actor with the given IRI and options.

func NewRandomHashlink(t *testing.T) *url.URL

NewRandomHashlink returns a randomly generated hashlink.

Types

type ServiceOpt

type ServiceOpt func(options *ServiceOptions)

ServiceOpt is a mock service option.

func WithPublicKey

func WithPublicKey(pubKey *vocab.PublicKeyType) ServiceOpt

WithPublicKey sets the public key on the mock service.

type ServiceOptions

type ServiceOptions struct {
	PublicKey *vocab.PublicKeyType
}

ServiceOptions are options passed in to NewMockService.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL