@@ -323,50 +323,27 @@ func getZonesResponseRecordsNonPaged(t *testing.T, w http.ResponseWriter) {
323323 w .Write (successResponseBytes )
324324}
325325
326- func getRrsetsResponseRecordsNonPaged (t * testing.T , w http.ResponseWriter , domain string ) {
326+ func getRrsetsResponseRecordsNonPaged (t * testing.T , w http.ResponseWriter , domain string , record string , id string ) {
327327 t .Helper ()
328328
329329 w .Header ().Set ("Content-Type" , "application/json" )
330330
331- var rrSets stackitdnsclient.ListRecordSetsResponse
332-
333- switch domain {
334- case "1234" :
335- rrSets = stackitdnsclient.ListRecordSetsResponse {
336- ItemsPerPage : pointerTo (int64 (20 )),
337- Message : pointerTo ("success" ),
338- RrSets : & []stackitdnsclient.RecordSet {
339- {
340- Name : pointerTo ("test.com." ),
341- Type : pointerTo (stackitdnsclient .RECORDSETTYPE_A ),
342- Ttl : pointerTo (int64 (300 )),
343- Records : & []stackitdnsclient.Record {
344- {Content : pointerTo ("1.2.3.4" )},
345- },
346- Id : pointerTo ("1234" ),
347- },
348- },
349- TotalItems : pointerTo (int64 (2 )),
350- TotalPages : pointerTo (int64 (1 )),
351- }
352- case "5678" :
353- rrSets = stackitdnsclient.ListRecordSetsResponse {
354- ItemsPerPage : pointerTo (int64 (20 )),
355- Message : pointerTo ("success" ),
356- RrSets : & []stackitdnsclient.RecordSet {
357- {
358- Name : pointerTo ("test2.com." ),
359- Type : pointerTo (stackitdnsclient .RECORDSETTYPE_A ),
360- Ttl : pointerTo (int64 (300 )),
361- Records : & []stackitdnsclient.Record {
362- {Content : pointerTo ("5.6.7.8" )},
363- },
364- Id : pointerTo ("5678" ),
331+ var rrSets = stackitdnsclient.ListRecordSetsResponse {
332+ ItemsPerPage : pointerTo (int64 (20 )),
333+ Message : pointerTo ("success" ),
334+ RrSets : & []stackitdnsclient.RecordSet {
335+ {
336+ Name : pointerTo (domain ),
337+ Type : pointerTo (stackitdnsclient .RECORDSETTYPE_A ),
338+ Ttl : pointerTo (int64 (300 )),
339+ Records : & []stackitdnsclient.Record {
340+ {Content : pointerTo (record )},
365341 },
342+ Id : pointerTo (id ),
366343 },
367- TotalItems : pointerTo ( int64 ( 2 )) ,
368- TotalPages : pointerTo (int64 (1 )),
369- }
344+ } ,
345+ TotalItems : pointerTo (int64 (2 )),
346+ TotalPages : pointerTo ( int64 ( 1 )),
370347 }
371348
372349 successResponseBytes , err := json .Marshal (rrSets )
@@ -386,10 +363,10 @@ func getServerRecords(t *testing.T) *httptest.Server {
386363 getZonesResponseRecordsNonPaged (t , w )
387364 })
388365 mux .HandleFunc ("/v1/projects/1234/zones/1234/rrsets" , func (w http.ResponseWriter , r * http.Request ) {
389- getRrsetsResponseRecordsNonPaged (t , w , "1234" )
366+ getRrsetsResponseRecordsNonPaged (t , w , "test.com." , "1.2.3.4" , " 1234" )
390367 })
391368 mux .HandleFunc ("/v1/projects/1234/zones/5678/rrsets" , func (w http.ResponseWriter , r * http.Request ) {
392- getRrsetsResponseRecordsNonPaged (t , w , "5678 " )
369+ getRrsetsResponseRecordsNonPaged (t , w , "test2.com." , "5.6.7.8" , "5689 " )
393370 })
394371
395372 return server
0 commit comments