Documentation ¶
Overview ¶
Package tests has the unit tests of package messaging. common file has the reused methods across the varoius unit test files
Index ¶
- Variables
- func CreateContext(inst aetest.Instance) context.Context
- func GenRandom() *rand.Rand
- func InitAppEngineContext(t *testing.T) (http.ResponseWriter, *http.Request)
- func ParseErrorResponse(channel chan []byte, responseChannel chan string)
- func ParseErrorResponseForTestSuccess(message string, channel chan []byte, responseChannel chan string)
- func ParseResponseDummy(channel chan []byte)
- func ParseResponseDummyMessage(channel chan []byte, message string, responseChannel chan string)
- func ParseWaitResponse(waitChannel chan string, t *testing.T, testName string)
- func PrintTestMessage(message string)
- func ReplaceEncodedChars(str string) string
- func WaitForCompletion(responseChannel chan string, waitChannel chan string)
- type CustomComplexMessage
- type CustomSingleElementStruct
- type CustomStruct
- type Data
- type EmptyStruct
- type Entry
- type PubnubDemoMessage
Constants ¶
This section is empty.
Variables ¶
var PamPubKey = "pam"
PamPubKey: key for pam tests
var PamSecKey = "pam"
PamSecKey: key for pam tests
var PamSubKey = "pam"
PamSubKey: key for pam tests
var PubKey = "demo-36"
PubKey: key for pam tests
var SecKey = "demo-36"
SecKey: key for pam tests
var SubKey = "demo-36"
SubKey: key for pam tests
Functions ¶
func InitAppEngineContext ¶
InitAppEngineContext initializes the httptest responsewriter and request To be used with unit tests
func ParseErrorResponse ¶
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 ¶
ParseResponseDummyMessage is a methods that reads the response on the channel but does notthing on it.
func ParseWaitResponse ¶
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 ¶
ReplaceEncodedChars takes a string as a parameter and returns a string with the unicode chars \\u003c, \\u003e, \\u0026 with <,> and & respectively
func WaitForCompletion ¶
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 ¶
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 PubnubDemoMessage ¶
type PubnubDemoMessage struct {
DefaultMessage string `json:",string"`
}
PubnubDemoMessage is a struct to test a non-alphanumeric message