Skip to content

Commit

Permalink
Fix more Write calls
Browse files Browse the repository at this point in the history
  • Loading branch information
loafoe committed Sep 28, 2024
1 parent d9c9415 commit 207809f
Show file tree
Hide file tree
Showing 20 changed files with 32 additions and 42 deletions.
3 changes: 1 addition & 2 deletions ai/inference/compute_target_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package inference_test

import (
"encoding/json"
"io"
"net/http"
"testing"

Expand Down Expand Up @@ -62,7 +61,7 @@ func TestComputeTargetCRD(t *testing.T) {
return
}
w.WriteHeader(http.StatusCreated)
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
default:
w.WriteHeader(http.StatusNotImplemented)
}
Expand Down
5 changes: 2 additions & 3 deletions ai/inference/job_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package inference_test

import (
"encoding/json"
"io"
"net/http"
"testing"

Expand Down Expand Up @@ -52,7 +51,7 @@ func TestJobCRD(t *testing.T) {
w.WriteHeader(http.StatusInternalServerError)
return
}
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
case http.MethodDelete:
w.WriteHeader(http.StatusOK)
default:
Expand All @@ -78,7 +77,7 @@ func TestJobCRD(t *testing.T) {
return
}
w.WriteHeader(http.StatusCreated)
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
default:
w.WriteHeader(http.StatusNotImplemented)
}
Expand Down
5 changes: 2 additions & 3 deletions ai/inference/model_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package inference_test

import (
"encoding/json"
"io"
"net/http"
"testing"

Expand Down Expand Up @@ -49,7 +48,7 @@ func TestModelCRD(t *testing.T) {
w.WriteHeader(http.StatusInternalServerError)
return
}
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
case http.MethodDelete:
w.WriteHeader(http.StatusOK)
default:
Expand All @@ -75,7 +74,7 @@ func TestModelCRD(t *testing.T) {
return
}
w.WriteHeader(http.StatusCreated)
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
default:
w.WriteHeader(http.StatusNotImplemented)
}
Expand Down
2 changes: 1 addition & 1 deletion cdl/study_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func TestResearchStudiesCRD(t *testing.T) {
w.WriteHeader(http.StatusInternalServerError)
return
}
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
case "GET":
w.WriteHeader(http.StatusOK)
_, _ = io.WriteString(w, `{
Expand Down
2 changes: 1 addition & 1 deletion cdr/operations_r4_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func TestR4PostOperation(t *testing.T) {
return
}
w.WriteHeader(http.StatusCreated)
_, _ = io.WriteString(w, string(jsonOrg))
_, _ = w.Write(jsonOrg)
default:
w.WriteHeader(http.StatusMethodNotAllowed)
}
Expand Down
2 changes: 1 addition & 1 deletion cdr/operations_stu3_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func TestPostOperation(t *testing.T) {
return
}
w.WriteHeader(http.StatusCreated)
_, _ = io.WriteString(w, string(jsonOrg))
_, _ = w.Write(jsonOrg)
default:
w.WriteHeader(http.StatusMethodNotAllowed)
}
Expand Down
2 changes: 1 addition & 1 deletion cdr/tenant_r4_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestR4TenantService(t *testing.T) {
return
}
w.WriteHeader(http.StatusCreated)
_, _ = io.WriteString(w, string(body))
_, _ = w.Write(body)
case "GET":
w.WriteHeader(http.StatusOK)
_, _ = io.WriteString(w, `{
Expand Down
2 changes: 1 addition & 1 deletion cdr/tenant_stu3_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestTenantService(t *testing.T) {
return
}
w.WriteHeader(http.StatusCreated)
_, _ = io.WriteString(w, string(body))
_, _ = w.Write(body)
case "GET":
w.WriteHeader(http.StatusOK)
_, _ = io.WriteString(w, `{
Expand Down
5 changes: 2 additions & 3 deletions dicom/config_service_cdr_service_account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package dicom_test

import (
"encoding/json"
"io"
"net/http"
"testing"

Expand Down Expand Up @@ -41,7 +40,7 @@ func TestCDRServiceAccountGetSet(t *testing.T) {
w.WriteHeader(http.StatusInternalServerError)
return
}
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
case "GET":
account := dicom.CDRServiceAccount{
ID: serviceAccountID,
Expand All @@ -52,7 +51,7 @@ func TestCDRServiceAccountGetSet(t *testing.T) {
return
}
w.WriteHeader(http.StatusOK)
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
default:
w.WriteHeader(http.StatusMethodNotAllowed)
}
Expand Down
5 changes: 2 additions & 3 deletions dicom/config_service_fhir_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package dicom_test

import (
"encoding/json"
"io"
"net/http"
"testing"

Expand Down Expand Up @@ -41,7 +40,7 @@ func TestFHIRStoreGetSet(t *testing.T) {
w.WriteHeader(http.StatusInternalServerError)
return
}
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
case "GET":
store := dicom.FHIRStore{
ID: storeID,
Expand All @@ -52,7 +51,7 @@ func TestFHIRStoreGetSet(t *testing.T) {
return
}
w.WriteHeader(http.StatusOK)
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
default:
w.WriteHeader(http.StatusMethodNotAllowed)
}
Expand Down
5 changes: 2 additions & 3 deletions dicom/config_service_import_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package dicom_test

import (
"encoding/json"
"io"
"net/http"
"testing"

Expand Down Expand Up @@ -41,7 +40,7 @@ func TestImportServiceGetSet(t *testing.T) {
w.WriteHeader(http.StatusInternalServerError)
return
}
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
case "GET":
store := dicom.ImportService{
ID: serviceID,
Expand All @@ -52,7 +51,7 @@ func TestImportServiceGetSet(t *testing.T) {
return
}
w.WriteHeader(http.StatusOK)
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
default:
w.WriteHeader(http.StatusMethodNotAllowed)
}
Expand Down
5 changes: 2 additions & 3 deletions dicom/config_service_object_stores_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package dicom_test

import (
"encoding/json"
"io"
"net/http"
"testing"

Expand Down Expand Up @@ -41,7 +40,7 @@ func TestObjectStoreCRUD(t *testing.T) {
w.WriteHeader(http.StatusInternalServerError)
return
}
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
default:
w.WriteHeader(http.StatusMethodNotAllowed)
}
Expand All @@ -66,7 +65,7 @@ func TestObjectStoreCRUD(t *testing.T) {
return
}
w.WriteHeader(http.StatusOK)
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
case "DELETE":
w.WriteHeader(http.StatusNoContent)
default:
Expand Down
5 changes: 2 additions & 3 deletions dicom/config_service_query_retrieve_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package dicom_test

import (
"encoding/json"
"io"
"net/http"
"testing"

Expand Down Expand Up @@ -41,7 +40,7 @@ func TestMoveServiceGetSet(t *testing.T) {
w.WriteHeader(http.StatusInternalServerError)
return
}
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
case "GET":
stores := []dicom.SCPConfig{
{
Expand All @@ -55,7 +54,7 @@ func TestMoveServiceGetSet(t *testing.T) {
return
}
w.WriteHeader(http.StatusOK)
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
default:
w.WriteHeader(http.StatusMethodNotAllowed)
}
Expand Down
7 changes: 3 additions & 4 deletions dicom/config_service_remote_notes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package dicom_test

import (
"encoding/json"
"io"
"net/http"
"testing"

Expand Down Expand Up @@ -42,7 +41,7 @@ func TestRemoteNodesCRUD(t *testing.T) {
w.WriteHeader(http.StatusInternalServerError)
return
}
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
case "GET":
repos := []dicom.RemoteNode{
{
Expand All @@ -60,7 +59,7 @@ func TestRemoteNodesCRUD(t *testing.T) {
return
}
w.WriteHeader(http.StatusOK)
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
default:
w.WriteHeader(http.StatusMethodNotAllowed)
}
Expand All @@ -80,7 +79,7 @@ func TestRemoteNodesCRUD(t *testing.T) {
return
}
w.WriteHeader(http.StatusOK)
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
case "DELETE":
w.WriteHeader(http.StatusNoContent)
default:
Expand Down
7 changes: 3 additions & 4 deletions dicom/config_service_repositories_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package dicom_test

import (
"encoding/json"
"io"
"net/http"
"testing"

Expand Down Expand Up @@ -42,7 +41,7 @@ func TestRepositoriesCRUD(t *testing.T) {
w.WriteHeader(http.StatusInternalServerError)
return
}
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
case "GET":
repos := []dicom.Repository{
{
Expand All @@ -57,7 +56,7 @@ func TestRepositoriesCRUD(t *testing.T) {
return
}
w.WriteHeader(http.StatusOK)
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
default:
w.WriteHeader(http.StatusMethodNotAllowed)
}
Expand All @@ -77,7 +76,7 @@ func TestRepositoriesCRUD(t *testing.T) {
return
}
w.WriteHeader(http.StatusOK)
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
case "DELETE":
w.WriteHeader(http.StatusNoContent)
default:
Expand Down
2 changes: 1 addition & 1 deletion iam/organizations_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func TestUpdateAndDeleteOrganization(t *testing.T) {
}
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
_, _ = io.WriteString(w, string(responseBody))
_, _ = w.Write(responseBody)
case "DELETE":
if r.Header.Get("If-Method") != "DELETE" {
w.WriteHeader(http.StatusForbidden)
Expand Down
2 changes: 1 addition & 1 deletion notification/producer_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func TestProducersCRD(t *testing.T) {
w.WriteHeader(http.StatusInternalServerError)
return
}
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
case "GET":
w.WriteHeader(http.StatusOK)
_, _ = io.WriteString(w, `{
Expand Down
2 changes: 1 addition & 1 deletion notification/subscriber_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func TestSubscribersCRD(t *testing.T) {
w.WriteHeader(http.StatusInternalServerError)
return
}
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
case "GET":
w.WriteHeader(http.StatusOK)
_, _ = io.WriteString(w, `{
Expand Down
4 changes: 2 additions & 2 deletions notification/subscription_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestSubscriptionCRD(t *testing.T) {
w.WriteHeader(http.StatusInternalServerError)
return
}
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
case "GET":
w.WriteHeader(http.StatusOK)
_, _ = io.WriteString(w, `{
Expand Down Expand Up @@ -116,7 +116,7 @@ func TestSubscriptionCRD(t *testing.T) {
return
}
w.WriteHeader(http.StatusCreated)
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
default:
w.WriteHeader(http.StatusMethodNotAllowed)
}
Expand Down
2 changes: 1 addition & 1 deletion notification/topic_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestTopicCRUD(t *testing.T) {
w.WriteHeader(http.StatusInternalServerError)
return
}
_, _ = io.WriteString(w, string(resp))
_, _ = w.Write(resp)
case "GET":
w.WriteHeader(http.StatusOK)
_, _ = io.WriteString(w, `{
Expand Down

0 comments on commit 207809f

Please sign in to comment.