Documentation

Overview

    Package maniptest contains a Mockable TransactionalManipulator. It implements all method of the TransactionalManipulator but do nothing.

    Methods can be mocked by using one of the MockXX method.

    For example:

    m := maniptest.NewTestManipulator()
    m.MockCreate(t, func(context *manipulate.Context, objects ...elemental.Identifiable) error {
        return elemental.NewError("title", "description", "subject", 43)
    })
    

    The next calls to the Create method will use the given method, in the context of the given *testing.T. If you need to reset the mocked method in the context of the same test, simply do:

    m.MockCreate(t, nil)
    

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    This section is empty.

    Types

    type TestManipulator

    type TestManipulator interface {
    	manipulate.TransactionalManipulator
    	MockRetrieveMany(t *testing.T, impl func(mctx manipulate.Context, dest elemental.Identifiables) error)
    	MockRetrieve(t *testing.T, impl func(mctx manipulate.Context, object elemental.Identifiable) error)
    	MockCreate(t *testing.T, impl func(mctx manipulate.Context, object elemental.Identifiable) error)
    	MockUpdate(t *testing.T, impl func(mctx manipulate.Context, object elemental.Identifiable) error)
    	MockDelete(t *testing.T, impl func(mctx manipulate.Context, object elemental.Identifiable) error)
    	MockDeleteMany(t *testing.T, impl func(mctx manipulate.Context, identity elemental.Identity) error)
    	MockCount(t *testing.T, impl func(mctx manipulate.Context, identity elemental.Identity) (int, error))
    	MockCommit(t *testing.T, impl func(tid manipulate.TransactionID) error)
    	MockAbort(t *testing.T, impl func(tid manipulate.TransactionID) bool)
    }

      A TestManipulator is the interface of mockable test manipulator.

      func NewTestManipulator

      func NewTestManipulator() TestManipulator

        NewTestManipulator returns a new TestManipulator.

        type TestSubscriber

        type TestSubscriber interface {
        	manipulate.Subscriber
        	MockStart(t *testing.T, impl func(context.Context, *elemental.PushConfig))
        	MockUpdateFilter(t *testing.T, impl func(*elemental.PushConfig))
        	MockEvents(t *testing.T, impl func() chan *elemental.Event)
        	MockErrors(t *testing.T, impl func() chan error)
        	MockStatus(t *testing.T, impl func() chan manipulate.SubscriberStatus)
        }

          A TestSubscriber is the interface of mockable test manipulator.

          func NewTestSubscriber

          func NewTestSubscriber() TestSubscriber

            NewTestSubscriber returns a new TestSubscriber.

            type TestTokenManager

            type TestTokenManager interface {
            	manipulate.TokenManager
            	MockIssue(t *testing.T, impl func(context.Context) (string, error))
            	MockRun(t *testing.T, impl func(ctx context.Context, tokenCh chan string))
            }

              A TestTokenManager is the interface of mockable test manipulator.

              func NewTestTokenManager

              func NewTestTokenManager() TestTokenManager

                NewTestTokenManager returns a new TestTokenManager.