fix: only query relevant records when looking up record ids on Ionos API (#19)
Reviewed-on: #19 Co-authored-by: Timo Behrendt <t.behrendt@t00n.de> Co-committed-by: Timo Behrendt <t.behrendt@t00n.de>
This commit was merged in pull request #19.
This commit is contained in:
@@ -76,7 +76,8 @@ func utilMockServerImpl() func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method == "GET" {
|
||||
if r.RequestURI == "/v1/zones" {
|
||||
response = zonesResponseJson
|
||||
} else if r.RequestURI == "/v1/zones/1234567890" {
|
||||
} else if r.RequestURI == "/v1/zones/1234567890?recordName=example.com&recordType=A" ||
|
||||
r.RequestURI == "/v1/zones/1234567890?recordName=sub.example.com&recordType=A" {
|
||||
response = zoneResponseJson
|
||||
} else if r.RequestURI == "/v1/zones/1234567890/records/abcdefghij" {
|
||||
response = recordResponseSubJson
|
||||
@@ -106,7 +107,7 @@ func TestHttpCall(t *testing.T) {
|
||||
|
||||
func testHttpCallGet(api IonosAPI) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
res, err := api.HttpCall("GET", "/v1/zones", nil)
|
||||
res, err := api.HttpCall("GET", "/v1/zones", nil, nil)
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("HttpCall() returned unexpected error: %v", err)
|
||||
@@ -120,7 +121,7 @@ func testHttpCallGet(api IonosAPI) func(t *testing.T) {
|
||||
|
||||
func testHttpCallPut(api IonosAPI) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
res, err := api.HttpCall("PUT", "/v1/zones/1234567890/records/abcdefghij", nil)
|
||||
res, err := api.HttpCall("PUT", "/v1/zones/1234567890/records/abcdefghij", nil, nil)
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("HttpCall() returned unexpected error: %v", err)
|
||||
@@ -141,7 +142,7 @@ func testHttpCallNonExistingEndpoint() func(t *testing.T) {
|
||||
|
||||
api := New("dummyKey", mockServer.URL)
|
||||
|
||||
res, err := api.HttpCall("GET", "/v1/nonExistingEndpoint", nil)
|
||||
res, err := api.HttpCall("GET", "/v1/nonExistingEndpoint", nil, nil)
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("HttpCall() returned unexpected error: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user