fix: resolve compilation errors in frontend and backend
This commit is contained in:
@@ -4,9 +4,6 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
@@ -14,6 +11,7 @@ import (
|
||||
"crussell/testutils/fixtures"
|
||||
)
|
||||
|
||||
|
||||
func TestPatchTests_CRUD(t *testing.T) {
|
||||
resetTestData(t)
|
||||
|
||||
@@ -30,8 +28,7 @@ func TestPatchTests_CRUD(t *testing.T) {
|
||||
ExpiryMonths: 6,
|
||||
ServiceIDs: []string{serviceID},
|
||||
}
|
||||
body, _ := json.Marshal(req)
|
||||
w := makeAdminRequest(http.HandlerFunc(CreatePatchTest), "POST", "/api/admin/patch-tests", bytes.NewReader(body))
|
||||
w := makeAdminRequest(http.HandlerFunc(CreatePatchTest), "POST", "/api/admin/patch-tests", req)
|
||||
if w.Code != http.StatusCreated {
|
||||
t.Fatalf("expected 201, got %d", w.Code)
|
||||
}
|
||||
@@ -54,10 +51,9 @@ func TestPatchTests_CRUD(t *testing.T) {
|
||||
|
||||
newName := "Updated Name"
|
||||
updateReq := UpdatePatchTestRequest{Name: &newName}
|
||||
updateBody, _ := json.Marshal(updateReq)
|
||||
w = makeAdminRequest(http.HandlerFunc(UpdatePatchTest), "PUT", "/api/admin/patch-tests/"+created.ID, bytes.NewReader(updateBody))
|
||||
w = makeAdminRequest(http.HandlerFunc(UpdatePatchTest), "PUT", "/api/admin/patch-tests/"+created.ID, updateReq)
|
||||
if w.Code != http.StatusNoContent {
|
||||
t.Fatalf("expected 204, got %d", w.Code)
|
||||
t.Fatalf("expected 204, got %d, body: %s", w.Code, w.Body.String())
|
||||
}
|
||||
|
||||
w = makeAdminRequest(http.HandlerFunc(DeletePatchTest), "DELETE", "/api/admin/patch-tests/"+created.ID, nil)
|
||||
|
||||
Reference in New Issue
Block a user