Package aetest
Overview ▹
Index ▹
Variables
PrepareDevAppserver is a hook which, if set, will be called before the dev_appserver.py is started, each time it is started. If aetest.NewContext is invoked from the goapp test tool, this hook is unnecessary.
var PrepareDevAppserver func() error
func Login ¶
func Login(u *user.User, req *http.Request)
Login causes the provided Request to act as though issued by the given user.
func Logout ¶
func Logout(req *http.Request)
Logout causes the provided Request to act as though issued by a logged-out user.
func NewContext ¶
func NewContext() (context.Context, func(), error)
NewContext starts an instance of the development API server, and returns a context that will route all API calls to that server, as well as a closure that must be called when the Context is no longer required.
type Instance ¶
Instance represents a running instance of the development API Server.
type Instance interface { // Close kills the child api_server.py process, releasing its resources. io.Closer // NewRequest returns an *http.Request associated with this instance. NewRequest(method, urlStr string, body io.Reader) (*http.Request, error) }
func NewInstance ¶
func NewInstance(opts *Options) (Instance, error)
NewInstance launches a running instance of api_server.py which can be used for multiple test Contexts that delegate all App Engine API calls to that instance. If opts is nil the default values are used.
type Options ¶
Options is used to specify options when creating an Instance.
type Options struct { // AppID specifies the App ID to use during tests. // By default, "testapp". AppID string // StronglyConsistentDatastore is whether the local datastore should be // strongly consistent. This will diverge from production behaviour. StronglyConsistentDatastore bool // StartupTimeout is a duration to wait for instance startup. // By default, 15 seconds. StartupTimeout time.Duration }