tests

package
v3.7.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2016 License: MIT Imports: 16 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 = "pub-c-1bd448ed-05ba-4dbc-81a5-7d6ff5c6e2bb"

PamPubKey: key for pam tests

View Source
var PamSecKey = "sec-c-ZDA1ZTdlNzAtYzU4Zi00MmEwLTljZmItM2ZhMDExZTE2ZmQ5"

PamSecKey: key for pam tests

View Source
var PamSubKey = "sub-c-90c51098-c040-11e5-a316-0619f8945a4f"

PamSubKey: key for pam tests

View Source
var PubKey = "pub-c-071e1a3f-607f-4351-bdd1-73a8eb21ba7c"

PubKey: key for non-pam tests

View Source
var PubNoPermissionsKey = "pub-c-5375d0d0-2088-43c6-864e-bcf6a6714212"

PubKey: key for non-pam tests

View Source
var SecKey = "sec-c-ZjM0NzNmODgtNzE4OC00OTBjLWFhMWMtYjUxZTllYmY5YWE4"

SecKey: key for non-pam tests

View Source
var SubKey = "sub-c-5c4fdcc6-c040-11e5-a316-0619f8945a4f"

SubKey: key for non-pam tests

View Source
var SubNoPermissionsKey = "sub-c-642a6fca-f5b9-11e5-9086-02ee2ddab7fe"

SubKey: key for non-pam tests

Functions

func ExpectConnectedEvent

func ExpectConnectedEvent(t *testing.T,
	channels, groups string, successChannel, errorChannel <-chan []byte)

func ExpectUnsubscribedEvent

func ExpectUnsubscribedEvent(t *testing.T,
	channels, groups string, successChannel, errorChannel <-chan []byte)

func GenRandom

func GenRandom() *rand.Rand

GenRandom gets a random instance

func GenerateTwoRandomChannelStrings

func GenerateTwoRandomChannelStrings(length int) (channels1, channels2 string)

func GetServerTime

func GetServerTime(uuid string) int64

func GetServerTimeString

func GetServerTimeString(uuid string) string

func IsConnectionRefusedError

func IsConnectionRefusedError(err []byte) bool

func LogErrors

func LogErrors(errorsChannel <-chan []byte)

func NewVCRBoth

func NewVCRBoth(name string, skipFields []string) (
	func(), func(int))

func NewVCRNonSubscribe

func NewVCRNonSubscribe(name string, skipFields []string) (
	func(), func(int))

func NewVCRSubscribe

func NewVCRSubscribe(name string, skipFields []string) func()

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)

ParseResponseDummy 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 RandomChannel

func RandomChannel() string

func RandomChannels

func RandomChannels(length int) string

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 PamResponse

type PamResponse struct {
	Payload interface{}
	Status  int
	Service string
	Message string
}

type PubnubDemoMessage

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

PubnubDemoMessage is a struct to test a non-alphanumeric message

type VCRTransportStub

type VCRTransportStub int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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