testing

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

messages unit tests

Index

Constants

View Source
const CreateMessageRequest = `` /* 267-byte string literal not displayed */

CreateMessageRequest is a sample request to create a message.

View Source
const CreateMessageResponse = `` /* 148-byte string literal not displayed */

CreateMessageResponse is a sample response to a Create message.

View Source
const GetMessageResponse = `` /* 324-byte string literal not displayed */

GetMessageResponse is a sample response to Get.

View Source
const GetMessagesResponse = `` /* 378-byte string literal not displayed */

GetMessagesResponse is a sample response to GetMessages.

View Source
const ListMessagesResponse1 = `` /* 582-byte string literal not displayed */

ListMessagesResponse is a sample response to list messages.

View Source
const ListMessagesResponse2 = `` /* 583-byte string literal not displayed */

ListMessagesResponse is a sample response to list messages.

View Source
const PopMessageResponse = `` /* 293-byte string literal not displayed */

PopMessageResponse is a sample reponse to pop messages

Variables

View Source
var ExpectedMessagesSet = []messages.Message{
	{
		Body: map[string]interface{}{
			"total_bytes":   "99614720",
			"current_bytes": "0",
			"event":         "BackupProgress",
		},
		Age:      443,
		Href:     "/v2/queues/beijing/messages/578f0055508f153f256f717f",
		ID:       "578f0055508f153f256f717f",
		TTL:      3600,
		Checksum: "",
	},
}

ExpectedMessagesSet is the expected result in GetMessages

View Source
var ExpectedMessagesSlice = [][]messages.Message{{FirstMessage}, {SecondMessage}}

ExpectedMessagesSlice is the expected result in a List.

View Source
var ExpectedPopMessage = []messages.PopMessage{{
	Body: map[string]interface{}{
		"current_bytes": "0",
		"event":         "BackupProgress",
		"total_bytes":   "99614720",
	},
	Age:        20,
	TTL:        120,
	ClaimID:    "123456",
	ClaimCount: 55,
	ID:         "5ae7972599352b436763aee7",
}}

ExpectedPopMessage is the expected result of a Pop.

View Source
var ExpectedResources = messages.ResourceList{
	Resources: []string{
		"/v2/queues/demoqueue/messages/51db6f78c508f17ddc924357",
		"/v2/queues/demoqueue/messages/51db6f78c508f17ddc924358",
	},
}

ExpectedResources is the expected result in Create

View Source
var FirstMessage = messages.Message{
	Body: map[string]interface{}{
		"current_bytes": "0",
		"event":         "BackupProgress",
		"total_bytes":   "99614720",
	},
	Age:      482,
	Href:     fmt.Sprintf("/v2/queues/%s/messages/578edfe6508f153f256f717b", QueueName),
	ID:       "578edfe6508f153f256f717b",
	TTL:      3600,
	Checksum: "MD5:abf7213555626e29c3cb3e5dc58b3515",
}

FirstMessage is the first result in a List.

View Source
var MessageID = "9988776655"

MessageID is the id of the message

View Source
var QueueName = "FakeTestQueue"

QueueName is the name of the queue

View Source
var SecondMessage = messages.Message{
	Body: map[string]interface{}{
		"current_bytes": "0",
		"event":         "BackupProgress",
		"total_bytes":   "99614720",
	},
	Age:      456,
	Href:     fmt.Sprintf("/v2/queues/%s/messages/578ee000508f153f256f717d", QueueName),
	ID:       "578ee000508f153f256f717d",
	TTL:      3600,
	Checksum: "MD5:abf7213555626e29c3cb3e5dc58b3515",
}

SecondMessage is the second result in a List.

Functions

func HandleCreateSuccessfully

func HandleCreateSuccessfully(t *testing.T)

HandleCreateSuccessfully configures the test server to respond to a Create request.

func HandleDeleteMessagesSuccessfully

func HandleDeleteMessagesSuccessfully(t *testing.T)

HandleDeleteMessagesSuccessfully configures the test server to respond to a Delete request.

func HandleDeleteSuccessfully

func HandleDeleteSuccessfully(t *testing.T)

HandleGetSuccessfully configures the test server to respond to a Get request.

func HandleGetMessagesSuccessfully

func HandleGetMessagesSuccessfully(t *testing.T)

HandleGetMessagesSuccessfully configures the test server to respond to a GetMessages request.

func HandleGetSuccessfully

func HandleGetSuccessfully(t *testing.T)

HandleGetSuccessfully configures the test server to respond to a Get request.

func HandleListSuccessfully

func HandleListSuccessfully(t *testing.T)

HandleListSuccessfully configures the test server to respond to a List request.

func HandlePopSuccessfully

func HandlePopSuccessfully(t *testing.T)

HandlePopSuccessfully configures the test server to respond to a Pop request.

Types

This section is empty.

Jump to

Keyboard shortcuts

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