gaetest

package
v0.0.0-...-ed9fe1d Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2018 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const FixtureLoggerKey = "web.gae.gaetest.fixture"

Variables

This section is empty.

Functions

func CleanupDatastore

func CleanupDatastore(ctx context.Context, namespaces ...string) error

CleanupDatastore is to remove all data in datastore

func CleanupStorage

func CleanupStorage(ctx context.Context, namespaces ...string) error

CleanupStorage cleans up all storage services (memcache and datastore)

func DatastoreFixture

func DatastoreFixture(ctx context.Context, path string, bindings interface{}) error

DatastoreFixture loads the fixtures from path to datastore.

func FixtureFromFile

func FixtureFromFile(ctx context.Context, path string, bindings interface{}) error

FixtureFromFile is to load fixtures from a file.

func FixtureFromMap

func FixtureFromMap(ctx context.Context, arr []map[string]interface{}) error

FixtureFromMap is to load fixtures from []map[string]interface{}

func Instance

func Instance() aetest.Instance

Instance returns a current appengine instance

func NewContext

func NewContext() context.Context

NewContext returns a new appengine context.Context

func NewRecorder

func NewRecorder(handler http.Handler) *httptest.Recorder

NewRecorder returns a new *httptest.Recorder object

func NewRequest

func NewRequest(method string, path string, body io.Reader) (*http.Request, error)

NewRequest returns a new *http.Request bound with appengine context.Context

func ResetFixtureFromFile

func ResetFixtureFromFile(ctx context.Context, path string, bindings interface{}, namespaces ...string) error

ResetFixtureFromFile is to reset all data in datastore and reload the fixtures from the file.

func ResetMemcache

func ResetMemcache(ctx context.Context, namespaces ...string) error

ResetMemcache resets all memcache entries

func Run

func Run(f func() int) int

Run runs gaetest server and run f in a clean way. Note:

this does not kill dev_appserver process if the test code fails in panic
even we use defer to close the instance. This is because each test are executed
in the different goroutine, which cannot be recovered.

Types

This section is empty.

Jump to

Keyboard shortcuts

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