testing

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 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(`{
	"tenant_name": "%s",
	"region": "jp1",
	"description": "%s",
	"contract_id": "%s"
}`,
	nameTenant1,
	descriptionTenant1,
	contractID,
)

CreateRequest is a sample request to create a tenant.

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

CreateTenantResponse 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,
}

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"
}`, idTenant1,
	nameTenant1,
	descriptionTenant1,
	contractID,
	startTime,
	contractID,
)

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,
}

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"
	}, {
		"tenant_id": "%s",
		"tenant_name": "jp2_tenant01",
		"description": "jp2 tenant",
		"region": "jp2",
		"start_time": "%s"
	}]
}
`,
	contractID,

	idTenant1,
	nameTenant1,
	descriptionTenant1,
	startTime,

	idTenant2,
	startTime,
)

ListResponse is a sample response to a List call.

View Source
var SecondTenant = tenants.Tenant{
	ContractID:   contractID,
	TenantID:     idTenant2,
	TenantName:   "jp2_tenant01",
	Description:  "jp2 tenant",
	TenantRegion: "jp2",
	StartTime:    TenantStartTime,
}

SecondTenant is the mock object of expected tenant-2

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

TenantStartTime is parsed tenant start time

View Source
var UpdateRequest = fmt.Sprintf(`
{
	"description": "%s"
}`,
	descriptionTenant1Update,
)

UpdateRequest is a sample request to update a zone.

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