Documentation ¶
Overview ¶
recordsets unit tests
Index ¶
Constants ¶
const TTLRecordSet1 = 3000
const TTLRecordSet1Update = 3600
Variables ¶
var CreateRequest = fmt.Sprintf(`{ "name" : "%s", "description" : "%s", "type" : "A", "ttl" : %d, "records" : ["%s"] }`, nameRecordSet1, descriptionRecordSet1, TTLRecordSet1, ipRecordSet1, )
CreateRequest is a sample request to create a resource record.
var CreateResponse = fmt.Sprintf(`{ "recordsets": [{ "id": "%s", "zone_id": "%s", "records": ["%s"], "ttl": %d, "name": "%s", "description": "%s", "type": "A", "version": 1, "created_at": "", "updated_at": null, "links": { "self": "dummylink" } }], "links": { "self": "dummylink" }, "metadata": { "total_count": 1 } }`, idRecordSet1, idZone, ipRecordSet1, TTLRecordSet1, nameRecordSet1, descriptionRecordSet1, )
CreateResponse is a sample response to a create request.
var ExpectedRecordSetSlice = []recordsets.RecordSet{FirstRecordSet, SecondRecordSet}
ExpectedRecordSetSlice is the slice of results that should be parsed from ListByZoneOutput, in the expected order.
var ExpectedRecordSetSliceLimited = []recordsets.RecordSet{SecondRecordSet}
ExpectedRecordSetSliceLimited is the slice of limited results that should be parsed from ListByZoneOutput.
var FirstRecordSet = recordsets.RecordSet{ ID: idRecordSet1, Description: descriptionRecordSet1, Records: []string{ipRecordSet1}, TTL: TTLRecordSet1, Name: nameRecordSet1, ZoneID: idZone, CreatedAt: RecordSetCreatedAt, UpdatedAt: RecordSetUpdatedAt, Version: 1, Type: "A", Status: "ACTIVE", Action: "", Links: []eclcloud.Link{ { Rel: "self", Href: "dummylink", }, }, }
FirstRecordSet is initialized struct as actual response
var GetResponse = fmt.Sprintf(`{ "id": "%s", "name": "%s", "ttl": %d, "description": "%s", "records": ["%s"], "type": "A", "version": 1, "created_at": "%s", "updated_at": "%s", "zone_id": "%s", "status": "ACTIVE", "links": { "self": "dummylink" } }`, idRecordSet1, nameRecordSet1, TTLRecordSet1, descriptionRecordSet1, ipRecordSet1, recordSetCreatedAt, recordSetUpdatedAt, idZone, )
GetResponse is a sample response to a Get call.
var ListResponse = fmt.Sprintf(`{ "recordsets": [{ "id": "%s", "action": "", "name": "%s", "ttl": %d, "description": "%s", "records": ["%s"], "type": "A", "version": 1, "status": "ACTIVE", "created_at": "%s", "updated_at": "%s", "zone_id": "%s", "links": { "self": "dummylink" } }, { "id": "%s", "action": "", "name": "rs2.zone1.com.", "ttl": 3000, "description": "a record set 2", "records": ["20.1.0.0"], "type": "A", "version": 1, "status": "ACTIVE", "created_at": "%s", "updated_at": "%s", "zone_id": "%s", "links": { "self": "dummylink" } }], "links": { "self": "dummylink" }, "metadata": { "total_count": 2 } }`, idRecordSet1, nameRecordSet1, TTLRecordSet1, descriptionRecordSet1, ipRecordSet1, recordSetCreatedAt, recordSetUpdatedAt, idZone, idRecordSet2, recordSetCreatedAt, recordSetUpdatedAt, idZone, )
ListResponse is a sample response to a TestListDNSRecordSet call.
var ListResponseLimited = fmt.Sprintf(`{
"recordsets": [{
"id": "%s",
"action": "",
"name": "rs2.zone1.com.",
"ttl": 3000,
"description": "a record set 2",
"records": ["20.1.0.0"],
"type": "A",
"version": 1,
"status": "ACTIVE",
"created_at": "%s",
"updated_at": "%s",
"zone_id": "%s",
"links": {
"self": "dummylink"
}
}],
"links": {
"self": "dummylink"
},
"metadata": {
"total_count": 1
}
}`,
idRecordSet2,
recordSetCreatedAt,
recordSetUpdatedAt,
idZone,
)
ListResponseLimited is a sample response with limit query option.
var NextPageRequest = fmt.Sprintf(`
{
"links": {
"self": "%s",
"next": "%s"
}
}`, selfURL, nextURL)
NextPageRequest is a sample request to test pagination.
var RecordSetCreatedAt, _ = time.Parse(eclcloud.RFC3339MilliNoZ, recordSetCreatedAt)
RecordSetCreatedAt is mocked created time of each records.
var RecordSetUpdatedAt, _ = time.Parse(eclcloud.RFC3339MilliNoZ, recordSetUpdatedAt)
RecordSetUpdatedAt is mocked updated time of each records.
var SecondRecordSet = recordsets.RecordSet{ ID: idRecordSet2, Description: "a record set 2", Records: []string{"20.1.0.0"}, TTL: 3000, Name: "rs2.zone1.com.", ZoneID: idZone, CreatedAt: RecordSetCreatedAt, UpdatedAt: RecordSetUpdatedAt, Version: 1, Type: "A", Status: "ACTIVE", Action: "", Links: []eclcloud.Link{ { Rel: "self", Href: "dummylink", }, }, }
SecondRecordSet is initialized struct as actual response
var UpdateRequest = fmt.Sprintf(`{ "name": "%s", "description" : "%s", "ttl" : %d, "records" : ["%s"] }`, nameRecordSet1Update, descriptionRecordSet1Update, TTLRecordSet1Update, ipRecordSet1Update, )
UpdateRequest is a sample request to update a record set.
var UpdateResponse = fmt.Sprintf(`{ "id": "%s", "name": "%s", "ttl": %d, "description": "%s", "records": "%s", "type": "A", "version": 1, "created_at": null, "updated_at": null, "zone_id": "%s", "links": { "self": "dummylink" } }`, idRecordSet1, nameRecordSet1Update, TTLRecordSet1Update, descriptionRecordSet1Update, ipRecordSet1Update, idZone, )
UpdateResponse is a sample response to an update request.
var UpdatedRecordSet = recordsets.RecordSet{ ID: idRecordSet1, Name: nameRecordSet1Update, TTL: TTLRecordSet1Update, Description: descriptionRecordSet1Update, Records: ipRecordSet1Update, Type: "A", Version: 1, CreatedAt: time.Time{}, UpdatedAt: time.Time{}, ZoneID: idZone, Links: []eclcloud.Link{ { Rel: "self", Href: "dummylink", }, }, }
UpdatedRecordSet is initialized struct as actual response of update
Functions ¶
This section is empty.
Types ¶
This section is empty.