testing

package
v0.5.18 Latest Latest
Warning

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

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

Documentation

Overview

services unit tests

Index

Constants

View Source
const CreateRequest = `` /* 163-byte string literal not displayed */

CreateRequest provides the input to a Create request.

View Source
const GetOutput = `` /* 350-byte string literal not displayed */

GetOutput provides a Get result.

View Source
const ListOutput = `` /* 824-byte string literal not displayed */

ListOutput provides a single page of Service results.

View Source
const UpdateOutput = `` /* 359-byte string literal not displayed */

UpdateOutput provides an update result.

View Source
const UpdateRequest = `
{
    "service": {
        "type": "compute2",
        "description": "Service Two Updated"
    }
}
`

UpdateRequest provides the input to as Update request.

Variables

View Source
var ExpectedServicesSlice = []services.Service{FirstService, SecondService}

ExpectedServicesSlice is the slice of services to be returned from ListOutput.

View Source
var FirstService = services.Service{
	ID: "1234",
	Links: map[string]interface{}{
		"self": "https://example.com/identity/v3/services/1234",
	},
	Type:    "identity",
	Enabled: false,
	Extra: map[string]interface{}{
		"name":        "service-one",
		"description": "Service One",
	},
}

FirstService is the first service in the List request.

View Source
var SecondService = services.Service{
	ID: "9876",
	Links: map[string]interface{}{
		"self": "https://example.com/identity/v3/services/9876",
	},
	Type:    "compute",
	Enabled: false,
	Extra: map[string]interface{}{
		"name":        "service-two",
		"description": "Service Two",
		"email":       "service@example.com",
	},
}

SecondService is the second service in the List request.

View Source
var SecondServiceUpdated = services.Service{
	ID: "9876",
	Links: map[string]interface{}{
		"self": "https://example.com/identity/v3/services/9876",
	},
	Type:    "compute2",
	Enabled: false,
	Extra: map[string]interface{}{
		"name":        "service-two",
		"description": "Service Two Updated",
		"email":       "service@example.com",
	},
}

SecondServiceUpdated is the SecondService should look after an Update.

Functions

func HandleCreateServiceSuccessfully

func HandleCreateServiceSuccessfully(t *testing.T)

HandleCreateServiceSuccessfully creates an HTTP handler at `/services` on the test handler mux that tests service creation.

func HandleGetServiceSuccessfully

func HandleGetServiceSuccessfully(t *testing.T)

HandleGetServiceSuccessfully creates an HTTP handler at `/services` on the test handler mux that responds with a single service.

func HandleListServicesSuccessfully

func HandleListServicesSuccessfully(t *testing.T)

HandleListServicesSuccessfully creates an HTTP handler at `/services` on the test handler mux that responds with a list of two services.

func HandleUpdateServiceSuccessfully

func HandleUpdateServiceSuccessfully(t *testing.T)

HandleUpdateServiceSuccessfully creates an HTTP handler at `/services` on the test handler mux that tests service update.

Types

This section is empty.

Jump to

Keyboard shortcuts

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