testing

package
v4.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

sss tenant unit tests

Index

Constants

This section is empty.

Variables

View Source
var CreateRequest = fmt.Sprintf(`{
	"workspace_id": "%s",
	"region": "jp1"
}`,
	workspaceID1,
)

CreateRequest is a sample request to create a tenant.

View Source
var CreateResponse = fmt.Sprintf(`{
	"workspace_id": "%s",
	"tenant_id": "%s",
	"tenant_name": "%s",
	"description": "%s",
	"region": "jp1",
	"contract_id": "%s"
}`, workspaceID1,
	idTenant1,
	nameTenant1,
	descriptionTenant1,
	contractID,
)

CreateResponse is a sample response to a create request.

View Source
var ExpectedTenantsSlice = []tenants.Tenant{FirstTenant, SecondTenant}

ExpectedTenantsSlice is the slice of results that should be parsed from ListResponse in the expected order.

View Source
var FirstTenant = tenants.Tenant{
	ContractID:   contractID,
	TenantID:     idTenant1,
	TenantName:   nameTenant1,
	Description:  descriptionTenant1,
	TenantRegion: "jp1",
	StartTime:    TenantStartTime,
	WorkspaceID:  workspaceID1,
}

FirstTenant is the mock object of expected tenant-1

View Source
var GetResponse = fmt.Sprintf(`
{
	"tenant_id": "%s",
	"tenant_name": "%s",
	"description": "%s",
	"region": "jp1",
	"contract_id": "%s",
	"region_api_endpoint": "https://example.com:443/api",
	"start_time": "%s",
	"users": [{
		"user_id": "ecid8000008888",
		"contract_id": "%s",
		"contract_owner": true
	}],
	"brand_id": "ecl2",
	"workspace_id": "%s"
}`, idTenant1,
	nameTenant1,
	descriptionTenant1,
	contractID,
	startTime,
	contractID,
	workspaceID1,
)

GetResponse is a sample response to a Get call. This get result does not have action, attributes in ECL2.0

View Source
var GetResponseStruct = tenants.Tenant{
	ContractID:        contractID,
	TenantID:          idTenant1,
	TenantName:        nameTenant1,
	Description:       descriptionTenant1,
	TenantRegion:      "jp1",
	StartTime:         TenantStartTime,
	RegionApiEndpoint: "https://example.com:443/api",
	User: []tenants.User{
		{
			UserID:        "ecid8000008888",
			ContractID:    contractID,
			ContractOwner: true,
		},
	},
	BrandID:     "ecl2",
	WorkspaceID: workspaceID1,
}

GetResponseStruct mocked actual tenant

View Source
var ListResponse = fmt.Sprintf(`
{
	"contract_id": "%s",
	"tenants": [{
		"tenant_id": "%s",
		"tenant_name": "%s",
		"description": "%s",
		"region": "jp1",
		"start_time": "%s",
		"workspace_id": "%s"
	}, {
		"tenant_id": "%s",
		"tenant_name": "%s",
		"description": "%s",
		"region": "jp2",
		"start_time": "%s",
		"workspace_id": "%s"
	}]
}
`,
	contractID,

	idTenant1,
	nameTenant1,
	descriptionTenant1,
	startTime,
	workspaceID1,

	idTenant2,
	nameTenant2,
	descriptionTenant2,
	startTime,
	workspaceID2,
)

ListResponse is a sample response to a List call.

View Source
var SecondTenant = tenants.Tenant{
	ContractID:   contractID,
	TenantID:     idTenant2,
	TenantName:   nameTenant2,
	Description:  descriptionTenant2,
	TenantRegion: "jp2",
	StartTime:    TenantStartTime,
	WorkspaceID:  workspaceID2,
}

SecondTenant is the mock object of expected tenant-2

View Source
var TenantStartTime, _ = time.Parse(eclcloud.RFC3339ZNoTNoZ, startTime)

TenantStartTime is parsed tenant start time

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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