From bc6e585b8d688009db2ba2d3c2085be1fe030718 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Wed, 3 Dec 2014 15:33:28 -0900 Subject: [PATCH] Updating measurement model (test methods) --- models/measurements.go | 1 + models/measurements_test.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/models/measurements.go b/models/measurements.go index 01ec8eb..f5f0bdd 100644 --- a/models/measurements.go +++ b/models/measurements.go @@ -24,6 +24,7 @@ type Measurement struct { ConfidenceInterval sql.NullFloat64 `db:"confidence_interval" json:"confidenceInterval"` UnitTypeId sql.NullInt64 `db:"unit_type_id" json:"unitTypeId"` Notes sql.NullString `db:"notes" json:"notes"` + TestMethodId sql.NullInt64 `db:"test_method_id" json:"testMethodId"` CreatedAt time.Time `db:"created_at" json:"createdAt"` UpdatedAt time.Time `db:"updated_at" json:"updatedAt"` } diff --git a/models/measurements_test.go b/models/measurements_test.go index c35d2c8..81a3713 100644 --- a/models/measurements_test.go +++ b/models/measurements_test.go @@ -58,7 +58,7 @@ func TestMeasurementService_Create(t *testing.T) { mux.HandleFunc(urlPath(t, router.CreateMeasurement, nil), func(w http.ResponseWriter, r *http.Request) { called = true testMethod(t, r, "POST") - testBody(t, r, `{"id":1,"strainId":1,"observationId":1,"textMeasurementTypeId":{"Int64":0,"Valid":false},"txtValue":{"String":"","Valid":false},"numValue":{"Float64":1.23,"Valid":true},"confidenceInterval":{"Float64":0,"Valid":false},"unitTypeId":{"Int64":1,"Valid":true},"notes":{"String":"","Valid":false},"createdAt":"0001-01-01T00:00:00Z","updatedAt":"0001-01-01T00:00:00Z"}`+"\n") + testBody(t, r, `{"id":1,"strainId":1,"observationId":1,"textMeasurementTypeId":{"Int64":0,"Valid":false},"txtValue":{"String":"","Valid":false},"numValue":{"Float64":1.23,"Valid":true},"confidenceInterval":{"Float64":0,"Valid":false},"unitTypeId":{"Int64":1,"Valid":true},"notes":{"String":"","Valid":false},"testMethodId":{"Int64":0,"Valid":false},"createdAt":"0001-01-01T00:00:00Z","updatedAt":"0001-01-01T00:00:00Z"}`+"\n") w.WriteHeader(http.StatusCreated) writeJSON(w, want) @@ -127,7 +127,7 @@ func TestMeasurementService_Update(t *testing.T) { mux.HandleFunc(urlPath(t, router.UpdateMeasurement, map[string]string{"Id": "1"}), func(w http.ResponseWriter, r *http.Request) { called = true testMethod(t, r, "PUT") - testBody(t, r, `{"id":1,"strainId":1,"observationId":1,"textMeasurementTypeId":{"Int64":0,"Valid":false},"txtValue":{"String":"","Valid":false},"numValue":{"Float64":4.56,"Valid":true},"confidenceInterval":{"Float64":0,"Valid":false},"unitTypeId":{"Int64":1,"Valid":true},"notes":{"String":"","Valid":false},"createdAt":"0001-01-01T00:00:00Z","updatedAt":"0001-01-01T00:00:00Z"}`+"\n") + testBody(t, r, `{"id":1,"strainId":1,"observationId":1,"textMeasurementTypeId":{"Int64":0,"Valid":false},"txtValue":{"String":"","Valid":false},"numValue":{"Float64":4.56,"Valid":true},"confidenceInterval":{"Float64":0,"Valid":false},"unitTypeId":{"Int64":1,"Valid":true},"notes":{"String":"","Valid":false},"testMethodId":{"Int64":0,"Valid":false},"createdAt":"0001-01-01T00:00:00Z","updatedAt":"0001-01-01T00:00:00Z"}`+"\n") w.WriteHeader(http.StatusOK) writeJSON(w, want) })