Documentation ¶
Overview ¶
zones unit tests
Index ¶
Constants ¶
This section is empty.
Variables ¶
var CreateZoneRequest = fmt.Sprintf(`{
"description": "%s",
"email": "joe@example.org",
"name": "%s",
"ttl": 7200,
"type": "PRIMARY"
}`,
descriptionZone1,
nameZone1,
)
CreateZoneRequest is a sample request to create a zone.
var CreateZoneResponse = fmt.Sprintf(`{
"id": "%s",
"name": "%s",
"description": "%s",
"project_id": "%s",
"pool_id": "",
"email": "",
"ttl": 0,
"serial": 0,
"status": "CREATING",
"masters": [],
"type": "",
"transferred_at": null,
"version": 1,
"created_at": "%s",
"updated_at": null,
"links": {
"self": "dummylink"
}
}`, idZone1,
nameZone1,
descriptionZone1,
tenantID,
zoneCreatedAt,
)
CreateZoneResponse is a sample response to a create request.
var CreatedZone = zones.Zone{ ID: idZone1, Name: nameZone1, Description: descriptionZone1, ProjectID: tenantID, PoolID: "", Email: "", TTL: 0, Serial: 0, Status: "CREATING", Masters: []string{}, Type: "", TransferredAt: time.Time{}, Version: 1, CreatedAt: ZoneCreatedAt, UpdatedAt: time.Time{}, Links: map[string]interface{}{ "self": "dummylink", }, }
CreatedZone is the expected created zone
var ExpectedZonesSlice = []zones.Zone{FirstZone, SecondZone}
ExpectedZonesSlice is the slice of results that should be parsed from ListOutput, in the expected order.
var FirstZone = zones.Zone{ ID: idZone1, PoolID: "", ProjectID: tenantID, Name: nameZone1, Email: "", TTL: 0, Serial: 0, Status: "ACTIVE", Description: descriptionZone1, Masters: []string{}, Type: "", TransferredAt: time.Time{}, Version: 1, CreatedAt: ZoneCreatedAt, UpdatedAt: ZoneUpdatedAt, Action: "", Attributes: []string{}, Links: map[string]interface{}{ "self": "dummylink", }, }
FirstZone is the mock object of expected zone-1
var GetResponse = fmt.Sprintf(`
{
"id": "%s",
"name": "%s",
"description": "%s",
"project_id": "%s",
"pool_id": "",
"email": "",
"ttl": 0,
"serial": 0,
"status": "ACTIVE",
"masters": [],
"type": "",
"transferred_at": null,
"version": 1,
"created_at": "%s",
"updated_at": "%s",
"links": {
"self": "dummylink"
}
}`, idZone1,
nameZone1,
descriptionZone1,
tenantID,
zoneCreatedAt,
zoneUpdatedAt,
)
GetResponse is a sample response to a Get call. This get result does not have action, attributes in ECL2.0
var GetResponseStruct = zones.Zone{ ID: idZone1, PoolID: "", ProjectID: tenantID, Name: nameZone1, Email: "", TTL: 0, Serial: 0, Status: "ACTIVE", Description: descriptionZone1, Masters: []string{}, Type: "", TransferredAt: time.Time{}, Version: 1, CreatedAt: ZoneCreatedAt, UpdatedAt: ZoneUpdatedAt, Action: "", Links: map[string]interface{}{ "self": "dummylink", }, }
GetResponseStruct mocked actual
var ListResponse = fmt.Sprintf(`
{
"api_result": "success",
"zones": [{
"id": "%s",
"description": "%s",
"project_id": "%s",
"created_at": "%s",
"updated_at": "%s",
"name": "%s",
"pool_id": "",
"email": "",
"ttl": 0,
"serial": 0,
"status": "ACTIVE",
"masters": [],
"type": "",
"transferred_at": null,
"version": 1,
"links": {
"self": "dummylink"
},
"action": "",
"attributes": []
}, {
"id": "%s",
"description": "This is my zone 2",
"project_id": "%s",
"created_at": "%s",
"updated_at": "%s",
"name": "myzone2.com.",
"pool_id": "",
"email": "",
"ttl": 0,
"serial": 0,
"status": "ACTIVE",
"masters": [],
"type": "",
"transferred_at": null,
"version": 1,
"links": {
"self": "dummylink"
},
"action": "",
"attributes": []
}],
"links": {
"self": "dummylink"
},
"metadata": {
"total_count": 2
}
}`,
idZone1,
descriptionZone1,
tenantID,
zoneCreatedAt,
zoneUpdatedAt,
nameZone1,
idZone2,
tenantID,
zoneCreatedAt,
zoneUpdatedAt,
)
ListResponse is a sample response to a List call.
var SecondZone = zones.Zone{ ID: idZone2, PoolID: "", ProjectID: tenantID, Name: "myzone2.com.", Email: "", TTL: 0, Serial: 0, Status: "ACTIVE", Description: "This is my zone 2", Masters: []string{}, Type: "", TransferredAt: time.Time{}, Version: 1, CreatedAt: ZoneCreatedAt, UpdatedAt: ZoneUpdatedAt, Action: "", Attributes: []string{}, Links: map[string]interface{}{ "self": "dummylink", }}
SecondZone is the mock object of expected zone-2
var UpdateZoneRequest = fmt.Sprintf(`
{
"ttl": 600,
"description": "%s",
"masters": [],
"email": ""
}`,
descriptionZone1Update,
)
UpdateZoneRequest is a sample request to update a zone.
var UpdateZoneResponse = fmt.Sprintf(`{
"id": "%s",
"name": "%s",
"description": "%s",
"project_id": "%s",
"pool_id": "",
"email": "",
"ttl": 0,
"serial": 0,
"status": "ACTIVE",
"masters": [],
"type": "",
"transferred_at": null,
"version": 1,
"created_at": "%s",
"updated_at": "%s",
"links": {
"self": "dummylink"
}
}`, idZone1,
nameZone1,
descriptionZone1Update,
tenantID,
zoneCreatedAt,
zoneUpdatedAt,
)
UpdateZoneResponse is a sample response to update a zone.
var UpdatedZone = zones.Zone{ ID: idZone1, Name: nameZone1, Description: descriptionZone1Update, ProjectID: tenantID, PoolID: "", Email: "", TTL: 0, Serial: 0, Status: "ACTIVE", Masters: []string{}, Type: "", TransferredAt: time.Time{}, Version: 1, CreatedAt: ZoneCreatedAt, UpdatedAt: ZoneUpdatedAt, Links: map[string]interface{}{ "self": "dummylink", }, }
UpdatedZone is the expected updated zone
var ZoneCreatedAt, _ = time.Parse(eclcloud.RFC3339MilliNoZ, zoneCreatedAt)
ZoneCreatedAt is parsed zone creation time
var ZoneUpdatedAt, _ = time.Parse(eclcloud.RFC3339MilliNoZ, zoneUpdatedAt)
ZoneUpdatedAt is parsed zone update time
Functions ¶
This section is empty.
Types ¶
This section is empty.