testing

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const CreateMetadataRequest = `
{
  "metadata": {
    "foo": "bar",
    "something": "something else"
  }
}`
View Source
const CreateMetadataResponse = `
{
    "metadata_ref": "http://barbican:9311/v1/secrets/1b12b69a-8822-442e-a303-da24ade648ac/metadata"
}`
View Source
const CreateRequest = `` /* 230-byte string literal not displayed */

CreateRequest provides the input to a Create request.

View Source
const CreateResponse = `
{
	"secret_ref": "http://barbican:9311/v1/secrets/1b8068c4-3bb6-4be6-8f1e-da0d1ea0b67c"
}`

CreateResponse provides a Create result.

View Source
const GetMetadataResponse = `
{
  "metadata": {
    "foo": "bar",
    "something": "something else"
    }
}`
View Source
const GetPayloadResponse = `foobar`

GetPayloadResponse provides a payload result.

View Source
const GetResponse = `` /* 452-byte string literal not displayed */

GetResponse provides a Get result.

View Source
const ListResponse = `` /* 1209-byte string literal not displayed */

ListResponse provides a single page of RESOURCE results.

View Source
const MetadatumRequest = `
{
  "key": "foo",
  "value": "bar"
}`
View Source
const MetadatumResponse = `
{
  "key": "foo",
  "value": "bar"
}`
View Source
const UpdateRequest = `foobar`

UpdateRequest provides the input to as Update request.

Variables

View Source
var ExpectedCreateMetadataResult = map[string]string{
	"metadata_ref": "http://barbican:9311/v1/secrets/1b12b69a-8822-442e-a303-da24ade648ac/metadata",
}

ExpectedCreateMetadataResult is the result of a Metadata create request.

View Source
var ExpectedCreateResult = secrets.Secret{
	SecretRef: "http://barbican:9311/v1/secrets/1b8068c4-3bb6-4be6-8f1e-da0d1ea0b67c",
}

ExpectedCreateResult is the result of a create request

View Source
var ExpectedMetadata = map[string]string{
	"foo":       "bar",
	"something": "something else",
}

ExpectedMetadata is the result of a Get or Create request.

View Source
var ExpectedMetadatum = secrets.Metadatum{
	Key:   "foo",
	Value: "bar",
}

ExpectedMetadatum is the result of a Metadatum Get, Create, or Update request

View Source
var ExpectedSecretsSlice = []secrets.Secret{FirstSecret, SecondSecret}

ExpectedSecretsSlice is the slice of secrets expected to be returned from ListResponse.

View Source
var FirstSecret = secrets.Secret{
	Algorithm: "aes",
	BitLength: 256,
	ContentTypes: map[string]string{
		"default": "text/plain",
	},
	Created:    time.Date(2018, 6, 21, 2, 49, 48, 0, time.UTC),
	CreatorID:  "5c70d99f4a8641c38f8084b32b5e5c0e",
	Mode:       "cbc",
	Name:       "mysecret",
	SecretRef:  "http://barbican:9311/v1/secrets/1b8068c4-3bb6-4be6-8f1e-da0d1ea0b67c",
	SecretType: "opaque",
	Status:     "ACTIVE",
	Updated:    time.Date(2018, 6, 21, 2, 49, 48, 0, time.UTC),
}

FirstSecret is the first secret in the List request.

View Source
var SecondSecret = secrets.Secret{
	Algorithm: "aes",
	BitLength: 256,
	ContentTypes: map[string]string{
		"default": "text/plain",
	},
	Created:    time.Date(2018, 6, 21, 5, 18, 45, 0, time.UTC),
	CreatorID:  "5c70d99f4a8641c38f8084b32b5e5c0e",
	Mode:       "cbc",
	Name:       "anothersecret",
	SecretRef:  "http://barbican:9311/v1/secrets/1b12b69a-8822-442e-a303-da24ade648ac",
	SecretType: "opaque",
	Status:     "ACTIVE",
	Updated:    time.Date(2018, 6, 21, 5, 18, 45, 0, time.UTC),
}

SecondSecret is the second secret in the List request.

Functions

func HandleCreateMetadataSuccessfully

func HandleCreateMetadataSuccessfully(t *testing.T)

HandleCreateMetadataSuccessfully creates an HTTP handler at `/secrets/uuid/metadata` on the test handler mux that responds with a metadata reference URL.

func HandleCreateMetadatumSuccessfully

func HandleCreateMetadatumSuccessfully(t *testing.T)

HandleCreateMetadatumSuccessfully creates an HTTP handler at `/secrets/uuid/metadata` on the test handler mux that responds with a single created metadata.

func HandleCreateSecretSuccessfully

func HandleCreateSecretSuccessfully(t *testing.T)

HandleCreateSecretSuccessfully creates an HTTP handler at `/secrets` on the test handler mux that tests secret creation.

func HandleDeleteMetadatumSuccessfully

func HandleDeleteMetadatumSuccessfully(t *testing.T)

HandleDeleteMetadatumSuccessfully creates an HTTP handler at `/secrets/uuid/metadata/key` on the test handler mux that tests metadata deletion.

func HandleDeleteSecretSuccessfully

func HandleDeleteSecretSuccessfully(t *testing.T)

HandleDeleteSecretSuccessfully creates an HTTP handler at `/secrets` on the test handler mux that tests secret deletion.

func HandleGetMetadataSuccessfully

func HandleGetMetadataSuccessfully(t *testing.T)

HandleGetMetadataSuccessfully creates an HTTP handler at `/secrets/uuid/metadata` on the test handler mux that responds with retrieved metadata.

func HandleGetMetadatumSuccessfully

func HandleGetMetadatumSuccessfully(t *testing.T)

HandleGetMetadatumSuccessfully creates an HTTP handler at `/secrets/uuid/metadata/foo` on the test handler mux that responds with a single metadatum.

func HandleGetPayloadSuccessfully

func HandleGetPayloadSuccessfully(t *testing.T)

HandleGetPayloadSuccessfully creates an HTTP handler at `/secrets` on the test handler mux that responds with a single secret.

func HandleGetSecretSuccessfully

func HandleGetSecretSuccessfully(t *testing.T)

HandleGetSecretSuccessfully creates an HTTP handler at `/secrets` on the test handler mux that responds with a single secret.

func HandleListSecretsSuccessfully

func HandleListSecretsSuccessfully(t *testing.T)

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

func HandleUpdateMetadatumSuccessfully

func HandleUpdateMetadatumSuccessfully(t *testing.T)

HandleUpdateMetadatumSuccessfully creates an HTTP handler at `/secrets/uuid/metadata/foo` on the test handler mux that responds with a single updated metadatum.

func HandleUpdateSecretSuccessfully

func HandleUpdateSecretSuccessfully(t *testing.T)

HandleUpdateSecretSuccessfully creates an HTTP handler at `/secrets` on the test handler mux that tests secret updates.

Types

This section is empty.

Jump to

Keyboard shortcuts

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