testing

package
v0.0.0-...-cd80d89 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package testing contains policies unit tests

Index

Constants

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

CreateRequest provides the input to a Create request.

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

GetOutput provides a Get result.

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

ListOutput provides a single page of Policy results.

View Source
const ListWithFilterOutput = `` /* 514-byte string literal not displayed */

ListWithFilterOutput provides a single page of filtered Policy results.

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

UpdateOutput provides an update result.

View Source
const UpdateRequest = `
{
    "policy": {
        "description": "updated policy for bar_user"
    }
}
`

UpdateRequest provides the input to as Update request.

Variables

View Source
var ExpectedPoliciesSlice = []policies.Policy{FirstPolicy, SecondPolicy}

ExpectedPoliciesSlice is the slice of policies expected to be returned from ListOutput.

View Source
var FirstPolicy = policies.Policy{
	ID:   "2844b2a08be147a08ef58317d6471f1f",
	Blob: "'foo_user': 'role:compute-user'",
	Type: "text/plain",
	Links: map[string]interface{}{
		"self": "http://example.com/identity/v3/policies/2844b2a08be147a08ef58317d6471f1f",
	},
	Extra: map[string]interface{}{},
}

FirstPolicy is the first policy in the List request.

View Source
var SecondPolicy = policies.Policy{
	ID:   "b49884da9d31494ea02aff38d4b4e701",
	Blob: "{'bar_user': 'role:network-user'}",
	Type: "application/json",
	Links: map[string]interface{}{
		"self": "http://example.com/identity/v3/policies/b49884da9d31494ea02aff38d4b4e701",
	},
	Extra: map[string]interface{}{
		"description": "policy for bar_user",
	},
}

SecondPolicy is the second policy in the List request.

View Source
var SecondPolicyUpdated = policies.Policy{
	ID:   "b49884da9d31494ea02aff38d4b4e701",
	Blob: "{'bar_user': 'role:network-user'}",
	Type: "application/json",
	Links: map[string]interface{}{
		"self": "http://example.com/identity/v3/policies/b49884da9d31494ea02aff38d4b4e701",
	},
	Extra: map[string]interface{}{
		"description": "updated policy for bar_user",
	},
}

SecondPolicyUpdated is the policy in the Update request.

Functions

func HandleCreatePolicySuccessfully

func HandleCreatePolicySuccessfully(t *testing.T)

HandleCreatePolicySuccessfully creates an HTTP handler at `/policies` on the test handler mux that tests policy creation.

func HandleDeletePolicySuccessfully

func HandleDeletePolicySuccessfully(t *testing.T)

HandleDeletePolicySuccessfully creates an HTTP handler at `/policies` on the test handler mux that tests policy deletion.

func HandleGetPolicySuccessfully

func HandleGetPolicySuccessfully(t *testing.T)

HandleGetPolicySuccessfully creates an HTTP handler at `/policies` on the test handler mux that responds with a single policy.

func HandleListPoliciesSuccessfully

func HandleListPoliciesSuccessfully(t *testing.T)

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

func HandleUpdatePolicySuccessfully

func HandleUpdatePolicySuccessfully(t *testing.T)

HandleUpdatePolicySuccessfully creates an HTTP handler at `/policies` on the test handler mux that tests role update.

Types

This section is empty.

Jump to

Keyboard shortcuts

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