testing

package
v1.1.3 Latest Latest
Warning

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

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

Documentation

Overview

roles unit tests

Index

Constants

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

CreateRequest provides the input to a Create request.

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

GetOutput provides a Get result.

View Source
const ListAssignmentOutput = `` /* 1338-byte string literal not displayed */

ListAssignmentOutput provides a result of ListAssignment request.

View Source
const ListAssignmentWithNamesOutput = `` /* 843-byte string literal not displayed */

ListAssignmentWithNamesOutput provides a result of ListAssignment request with IncludeNames option.

View Source
const ListAssignmentsOnResourceOutput = `` /* 461-byte string literal not displayed */

ListAssignmentsOnResourceOutput provides a result of ListAssignmentsOnResource request.

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

ListOutput provides a single page of Role results.

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

UpdateOutput provides an update result.

View Source
const UpdateRequest = `
{
    "role": {
        "description": "admin read-only support role"
    }
}
`

UpdateRequest provides the input to as Update request.

Variables

ExpectedRoleAssignmentsSlice is the slice of role assignments expected to be returned from ListAssignmentOutput.

View Source
var ExpectedRoleAssignmentsWithNamesSlice = []roles.RoleAssignment{ThirdRoleAssignment}

ExpectedRoleAssignmentsWithNamesSlice is the slice of role assignments expected to be returned from ListAssignmentWithNamesOutput.

View Source
var ExpectedRolesOnResourceSlice = []roles.Role{RoleOnResource}

ExpectedRolesOnResourceSlice is the slice of roles expected to be returned from ListAssignmentsOnResourceOutput.

View Source
var ExpectedRolesSlice = []roles.Role{FirstRole, SecondRole}

ExpectedRolesSlice is the slice of roles expected to be returned from ListOutput.

View Source
var FirstRole = roles.Role{
	DomainID: "default",
	ID:       "2844b2a08be147a08ef58317d6471f1f",
	Links: map[string]interface{}{
		"self": "http://example.com/identity/v3/roles/2844b2a08be147a08ef58317d6471f1f",
	},
	Name:  "admin-read-only",
	Extra: map[string]interface{}{},
}

FirstRole is the first role in the List request.

View Source
var FirstRoleAssignment = roles.RoleAssignment{
	Role:  roles.AssignedRole{ID: "123456"},
	Scope: roles.Scope{Domain: roles.Domain{ID: "161718"}},
	User:  roles.User{Domain: roles.Domain{ID: "161718"}, ID: "313233"},
	Group: roles.Group{},
}

FirstRoleAssignment is the first role assignment in the List request.

View Source
var RoleOnResource = roles.Role{
	ID: "9fe1d3",
	Links: map[string]interface{}{
		"self": "https://example.com/identity/v3/roles/9fe1d3",
	},
	Name: "support",
	Extra: map[string]interface{}{
		"description": "read-only support role",
	},
}

RoleOnResource is the role in the ListAssignmentsOnResource request.

View Source
var SecondRole = roles.Role{
	DomainID: "1789d1",
	ID:       "9fe1d3",
	Links: map[string]interface{}{
		"self": "https://example.com/identity/v3/roles/9fe1d3",
	},
	Name: "support",
	Extra: map[string]interface{}{
		"description": "read-only support role",
	},
}

SecondRole is the second role in the List request.

View Source
var SecondRoleAssignment = roles.RoleAssignment{
	Role:  roles.AssignedRole{ID: "123456"},
	Scope: roles.Scope{Project: roles.Project{Domain: roles.Domain{ID: "161718"}, ID: "456789"}},
	User:  roles.User{Domain: roles.Domain{ID: "161718"}, ID: "313233"},
	Group: roles.Group{},
}

SecondRoleAssignemnt is the second role assignemnt in the List request.

View Source
var SecondRoleUpdated = roles.Role{
	DomainID: "1789d1",
	ID:       "9fe1d3",
	Links: map[string]interface{}{
		"self": "https://example.com/identity/v3/roles/9fe1d3",
	},
	Name: "support",
	Extra: map[string]interface{}{
		"description": "admin read-only support role",
	},
}

SecondRoleUpdated is how SecondRole should look after an Update.

View Source
var ThirdRoleAssignment = roles.RoleAssignment{
	Role:  roles.AssignedRole{ID: "123456", Name: "include_names_role"},
	Scope: roles.Scope{Domain: roles.Domain{ID: "161718", Name: "52833"}},
	User:  roles.User{Domain: roles.Domain{ID: "161718", Name: "52833"}, ID: "313233", Name: "example-user-name"},
	Group: roles.Group{},
}

ThirdRoleAssignment is the third role assignment that has entity names in the List request.

Functions

func HandleAssignSuccessfully

func HandleAssignSuccessfully(t *testing.T)

func HandleCreateRoleSuccessfully

func HandleCreateRoleSuccessfully(t *testing.T)

HandleCreateRoleSuccessfully creates an HTTP handler at `/roles` on the test handler mux that tests role creation.

func HandleDeleteRoleSuccessfully

func HandleDeleteRoleSuccessfully(t *testing.T)

HandleDeleteRoleSuccessfully creates an HTTP handler at `/roles` on the test handler mux that tests role deletion.

func HandleGetRoleSuccessfully

func HandleGetRoleSuccessfully(t *testing.T)

HandleGetRoleSuccessfully creates an HTTP handler at `/roles` on the test handler mux that responds with a single role.

func HandleListAssignmentsOnResourceSuccessfully_DomainsGroups

func HandleListAssignmentsOnResourceSuccessfully_DomainsGroups(t *testing.T)

func HandleListAssignmentsOnResourceSuccessfully_DomainsUsers

func HandleListAssignmentsOnResourceSuccessfully_DomainsUsers(t *testing.T)

func HandleListAssignmentsOnResourceSuccessfully_ProjectsGroups

func HandleListAssignmentsOnResourceSuccessfully_ProjectsGroups(t *testing.T)

func HandleListAssignmentsOnResourceSuccessfully_ProjectsUsers

func HandleListAssignmentsOnResourceSuccessfully_ProjectsUsers(t *testing.T)

func HandleListRoleAssignmentsSuccessfully

func HandleListRoleAssignmentsSuccessfully(t *testing.T)

HandleListRoleAssignmentsSuccessfully creates an HTTP handler at `/role_assignments` on the test handler mux that responds with a list of two role assignments.

func HandleListRoleAssignmentsWithNamesSuccessfully

func HandleListRoleAssignmentsWithNamesSuccessfully(t *testing.T)

HandleListRoleAssignmentsSuccessfully creates an HTTP handler at `/role_assignments` on the test handler mux that responds with a list of two role assignments.

func HandleListRoleAssignmentsWithSubtreeSuccessfully

func HandleListRoleAssignmentsWithSubtreeSuccessfully(t *testing.T)

HandleListRoleAssignmentsWithSubtreeSuccessfully creates an HTTP handler at `/role_assignments` on the test handler mux that responds with a list of two role assignments.

func HandleListRolesSuccessfully

func HandleListRolesSuccessfully(t *testing.T)

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

func HandleUnassignSuccessfully

func HandleUnassignSuccessfully(t *testing.T)

func HandleUpdateRoleSuccessfully

func HandleUpdateRoleSuccessfully(t *testing.T)

HandleUpdateRoleSuccessfully creates an HTTP handler at `/roles` 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