Documentation ¶
Overview ¶
sss tenant unit tests
Index ¶
Constants ¶
This section is empty.
Variables ¶
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.
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.
var ExpectedTenantsSlice = []tenants.Tenant{FirstTenant, SecondTenant}
ExpectedTenantsSlice is the slice of results that should be parsed from ListResponse in the expected order.
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
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
var GetResponseStruct = tenants.Tenant{ ContractID: contractID, TenantID: idTenant1, TenantName: nameTenant1, Description: descriptionTenant1, TenantRegion: "jp1", StartTime: TenantStartTime, }
GetResponseStruct mocked actual tenant
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.
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
var TenantStartTime, _ = time.Parse(eclcloud.RFC3339ZNoTNoZ, startTime)
TenantStartTime is parsed tenant start time
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.