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 ExpectConnectedEvent(t *testing.T, channels, groups string, ...)
- func ExpectUnsubscribedEvent(t *testing.T, channels, groups string, ...)
- func GenRandom() *rand.Rand
- func GenerateTwoRandomChannelStrings(length int) (channels1, channels2 string)
- func GetServerTime(uuid string) int64
- func GetServerTimeString(uuid string) string
- func IsConnectionRefusedError(err []byte) bool
- func LogErrors(errorsChannel <-chan []byte)
- func NewVCRBoth(name string, skipFields []string) (func(), func(int))
- func NewVCRNonSubscribe(name string, skipFields []string) (func(), func(int))
- func NewVCRSubscribe(name string, skipFields []string) func()
- 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 RandomChannel() string
- func RandomChannels(length int) 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 PamResponse
- type PubnubDemoMessage
- type VCRTransportStub
Constants ¶
This section is empty.
Variables ¶
var PamPubKey = "pub-c-1bd448ed-05ba-4dbc-81a5-7d6ff5c6e2bb"
PamPubKey: key for pam tests
var PamSecKey = "sec-c-ZDA1ZTdlNzAtYzU4Zi00MmEwLTljZmItM2ZhMDExZTE2ZmQ5"
PamSecKey: key for pam tests
var PamSubKey = "sub-c-90c51098-c040-11e5-a316-0619f8945a4f"
PamSubKey: key for pam tests
var PubKey = "pub-c-071e1a3f-607f-4351-bdd1-73a8eb21ba7c"
PubKey: key for non-pam tests
var PubNoPermissionsKey = "pub-c-5375d0d0-2088-43c6-864e-bcf6a6714212"
PubKey: key for non-pam tests
var SecKey = "sec-c-ZjM0NzNmODgtNzE4OC00OTBjLWFhMWMtYjUxZTllYmY5YWE4"
SecKey: key for non-pam tests
var SubKey = "sub-c-5c4fdcc6-c040-11e5-a316-0619f8945a4f"
SubKey: key for non-pam tests
var SubNoPermissionsKey = "sub-c-642a6fca-f5b9-11e5-9086-02ee2ddab7fe"
SubKey: key for non-pam tests
Functions ¶
func ExpectConnectedEvent ¶
func ExpectUnsubscribedEvent ¶
func GetServerTime ¶
func GetServerTimeString ¶
func NewVCRBoth ¶
func NewVCRNonSubscribe ¶
func NewVCRSubscribe ¶
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 ¶
ParseResponseDummy 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 RandomChannel ¶
func RandomChannel() string
func RandomChannels ¶
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 PamResponse ¶
type PubnubDemoMessage ¶
type PubnubDemoMessage struct {
DefaultMessage string `json:",string"`
}
PubnubDemoMessage is a struct to test a non-alphanumeric message
type VCRTransportStub ¶
type VCRTransportStub int