tests

package
v3.9.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2016 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package tests has the unit tests of package messaging. common file has the reused methods across the varoius unit test files

Index

Constants

This section is empty.

Variables

View Source
var PamPubKey = "pam"

PamPubKey: key for pam tests

View Source
var PamSecKey = "pam"

PamSecKey: key for pam tests

View Source
var PamSubKey = "pam"

PamSubKey: key for pam tests

View Source
var PubKey = "demo-36"

PubKey: key for pam tests

View Source
var SecKey = "demo-36"

SecKey: key for pam tests

View Source
var SubKey = "demo-36"

SubKey: key for pam tests

Functions

func CreateContext

func CreateContext(inst aetest.Instance) context.Context

func GenRandom

func GenRandom() *rand.Rand

GenRandom gets a random instance

func InitAppEngineContext

func InitAppEngineContext(t *testing.T) (http.ResponseWriter, *http.Request)

InitAppEngineContext initializes the httptest responsewriter and request To be used with unit tests

func ParseErrorResponse

func ParseErrorResponse(channel chan []byte, responseChannel chan string)

ParseErrorResponse parses the response of the Error channel. It prints the response to the response channel

func ParseErrorResponseForTestSuccess

func ParseErrorResponseForTestSuccess(message string, channel chan []byte, responseChannel chan string)

ParseErrorResponseForTestSuccess parses the response of the Error channel. It prints the response to the response channel

func ParseResponseDummy

func ParseResponseDummy(channel chan []byte)

ParseResponseDummy is a methods that reads the response on the channel but does notthing on it.

func ParseResponseDummyMessage

func ParseResponseDummyMessage(channel chan []byte, message string, responseChannel chan string)

ParseResponseDummyMessage is a methods that reads the response on the channel but does notthing on it.

func ParseWaitResponse

func ParseWaitResponse(waitChannel chan string, t *testing.T, testName string)

ParseWaitResponse parses the response of the wait channel. If the response contains the string "passed" then the test is passed else it is failed.

Parameters: waitChannel: channel to read t: the testing.T instance testName to display.

func PrintTestMessage

func PrintTestMessage(message string)

PrintTestMessage is common method to print the message on the screen.

func ReplaceEncodedChars

func ReplaceEncodedChars(str string) string

ReplaceEncodedChars takes a string as a parameter and returns a string with the unicode chars \\u003c, \\u003e, \\u0026 with <,> and & respectively

func WaitForCompletion

func WaitForCompletion(responseChannel chan string, waitChannel chan string)

WaitForCompletion reads the response on the responseChannel or waits till the timeout occurs. if the response is received before the timeout the response is sent to the waitChannel else the test is timed out.

Parameters: responseChannel: channel to read. waitChannel: channel to respond to.

Types

type CustomComplexMessage

type CustomComplexMessage struct {
	VersionID     float32 `json:",string"`
	TimeToken     int64   `json:",string"`
	OperationName string
	Channels      []string
	DemoMessage   PubnubDemoMessage `json:",string"`
	SampleXML     string            `json:",string"`
}

CustomComplexMessage is used to test the custom structure encryption and decryption. The variables "foo" and "bar" as used in the other languages are not accepted by golang and give an empty value when serialized, used "Foo" and "Bar" instead.

func InitComplexMessage

func InitComplexMessage() CustomComplexMessage

InitComplexMessage initializes a complex structure of the type CustomComplexMessage which includes a xml, struct of type PubnubDemoMessage, strings, float and integer.

type CustomSingleElementStruct

type CustomSingleElementStruct struct {
	Foo string
}

CustomSingleElementStruct Used to test the custom structure encryption and decryption The variables "foo" and "bar" as used in the other languages are not accepted by golang and give an empty value when serialized, used "Foo" and "Bar" instead.

type CustomStruct

type CustomStruct struct {
	Foo string
	Bar []int
}

CustomStruct to test the custom structure encryption and decryption The variables "foo" and "bar" as used in the other languages are not accepted by golang and give an empty value when serialized, used "Foo" and "Bar" instead.

type Data

type Data struct {
	XMLName xml.Name `xml:"data"`
	//Entry   []Entry  `xml:"entry"`
	Name string `xml:"name"`
	Age  int    `xml:"age"`
}

Data represents a <data> element.

type EmptyStruct

type EmptyStruct struct {
}

EmptyStruct provided the empty struct to test the encryption.

type Entry

type Entry struct {
	Name string `xml:"name"`
	Age  int    `xml:"age"`
}

Entry represents an <entry> element.

type PubnubDemoMessage

type PubnubDemoMessage struct {
	DefaultMessage string `json:",string"`
}

PubnubDemoMessage is a struct to test a non-alphanumeric message

Jump to

Keyboard shortcuts

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