appenginetesting

package module
v0.0.0-...-93104ad Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2013 License: Apache-2.0 Imports: 18 Imported by: 1

README

gae-go-testing

Testing library for Go App Engine, giving you an appengine.Context fake that forwards to a dev_appserver.py child process. This library is fixed for go1 based on http://code.google.com/p/gae-go-testing/ . This library works on GAE/G 1.7.0 or higher and go1 and tested on:

* GAE/G 1.7.0, go 1.0.2
* GAE/G 1.7.1, go 1.0.2

Installation

Set environment variables :

export APPENGINE_SDK=/usr/local/google_appengine
export PATH=$PATH:$APPENGINE_SDK

Before installing this library, you have to install appengine SDK. And copy appengine, appengine_internal and goprotobuf as followings :

curl https://raw.github.com/tenntenn/gae-go-testing/master/setup.py | python

This library can be installed as following :

$go get github.com/tenntenn/gae-go-testing

Usage

context_test.go and recorder_test.go show an example of usage.

Documentation

Overview

Package appenginetesting provides an appengine.Context for testing.

Index

Constants

View Source
const DefaultAPIVersion = "go1"

Default API Version

Variables

View Source
var APIVersion = DefaultAPIVersion

API version of golang. It is used for app.yaml of dev_server setting.

Functions

This section is empty.

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context implements appengine.Context by running a dev_appserver.py process as a child and proxying all Context calls to the child. Use NewContext to create one.

func NewContext

func NewContext(opts *Options) (*Context, error)

NewContext returns a new AppEngine context with an empty datastore, etc. A nil Options is valid and means to use the default values.

func (*Context) AppID

func (c *Context) AppID() string

func (*Context) Call

func (c *Context) Call(service, method string, in, out proto.Message, opts *appengine_internal.CallOptions) error

func (*Context) Close

func (c *Context) Close()

Close kills the child dev_appserver.py process, releasing its resources.

Close is not part of the appengine.Context interface.

func (*Context) Criticalf

func (c *Context) Criticalf(format string, args ...interface{})

func (*Context) Debugf

func (c *Context) Debugf(format string, args ...interface{})

func (*Context) Errorf

func (c *Context) Errorf(format string, args ...interface{})

func (*Context) FullyQualifiedAppID

func (c *Context) FullyQualifiedAppID() string

func (*Context) Infof

func (c *Context) Infof(format string, args ...interface{})

func (*Context) Request

func (c *Context) Request() interface{}

func (*Context) Warningf

func (c *Context) Warningf(format string, args ...interface{})

type ContextRecorder

type ContextRecorder struct {
	// contains filtered or unexported fields
}

func NewContextRecorder

func NewContextRecorder(opts *Options) *ContextRecorder

func (*ContextRecorder) Context

func (r *ContextRecorder) Context() *Context

func (*ContextRecorder) Creator

func (r *ContextRecorder) Creator() func(r *http.Request) appengine.Context

type Options

type Options struct {
	// AppId to pretend to be. By default, "testapp"
	AppId string
}

Options control optional behavior for NewContext.

Jump to

Keyboard shortcuts

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