@@ -28,32 +28,32 @@ func TestPutEnviron(t *testing.T) {
2828
2929 t .Run ("POST value" , func (t * testing.T ) {
3030 status , result := testFunc (t , fmt .Sprintf ("{\" %s\" : \" updated\" }\n " , t .Name ()))
31- assert .Equal (t , status , http .StatusOK , "status was not 200OK" )
32- assert .Equal (t , result , "updated" , "env var was not updated" )
31+ assert .Equal (t , http .StatusOK , status , "status was not 200OK" )
32+ assert .Equal (t , "updated" , result , "env var was not updated" )
3333 })
3434
3535 t .Run ("POST empty" , func (t * testing.T ) {
3636 status , result := testFunc (t , fmt .Sprintf ("{\" %s\" : \" \" }\n " , t .Name ()))
37- assert .Equal (t , status , http .StatusOK , "status was not 200OK" )
38- assert .Equal (t , result , "" , "env var should be cleared" )
37+ assert .Equal (t , http .StatusOK , status , "status was not 200OK" )
38+ assert .Equal (t , "" , result , "env var should be cleared" )
3939 })
4040
4141 t .Run ("POST null" , func (t * testing.T ) {
4242 status , result := testFunc (t , fmt .Sprintf ("{\" %s\" : null}\n " , t .Name ()))
43- assert .Equal (t , status , http .StatusOK , "status was not 200OK" )
44- assert .Equal (t , result , "" , "env var should be cleared" )
43+ assert .Equal (t , http .StatusOK , status , "status was not 200OK" )
44+ assert .Equal (t , "" , result , "env var should be cleared" )
4545 })
4646
4747 t .Run ("POST string null" , func (t * testing.T ) {
4848 status , result := testFunc (t , fmt .Sprintf ("{\" %s\" : \" null\" }\n " , t .Name ()))
49- assert .Equal (t , status , http .StatusOK , "status was not 200OK" )
50- assert .Equal (t , result , "null" , "env var should not be cleared" )
49+ assert .Equal (t , http .StatusOK , status , "status was not 200OK" )
50+ assert .Equal (t , "null" , result , "env var should not be cleared" )
5151 })
5252
5353 t .Run ("POST bad JSON" , func (t * testing.T ) {
5454 status , result := testFunc (t , "{{\n " )
55- assert .Equal (t , status , http .StatusUnprocessableEntity , "status was not 422" )
56- assert .Equal (t , result , "original" , "env var should not be updated" )
55+ assert .Equal (t , http .StatusUnprocessableEntity , status , "status was not 422" )
56+ assert .Equal (t , "original" , result , "env var should not be updated" )
5757 })
5858}
5959
@@ -76,17 +76,17 @@ func TestPostHandler(t *testing.T) {
7676 func (r * http.Request ) (interface {}, int ) {
7777 return nil , 200
7878 })
79- assert .Equal (t , status , 200 , "expected HTTP 200 OK" )
80- assert .Equal (t , result , "\n " )
79+ assert .Equal (t , 200 , status , "expected HTTP 200 OK" )
80+ assert .Equal (t , "\n " , result )
8181 })
8282
8383 t .Run ("POST JSON ok" , func (t * testing.T ) {
8484 req := httptest .NewRequest ("POST" , "/v3/foo" , nil )
8585 status , result := testFunc (req , func (r * http.Request ) (interface {}, int ) {
8686 return map [string ]string {"key" : "val" }, 200
8787 })
88- assert .Equal (t , status , 200 , "expected HTTP 200 OK" )
89- assert .Equal (t , result , "{\" key\" :\" val\" }\n " ,
88+ assert .Equal (t , 200 , status , "expected HTTP 200 OK" )
89+ assert .Equal (t , "{\" key\" :\" val\" }\n " , result ,
9090 "expected JSON body in reply" )
9191 })
9292
@@ -96,8 +96,8 @@ func TestPostHandler(t *testing.T) {
9696 func (r * http.Request ) (interface {}, int ) {
9797 return nil , 200
9898 })
99- assert .Equal (t , status , 405 , "expected HTTP405 method not allowed" )
100- assert .Equal (t , result , "Method Not Allowed\n " )
99+ assert .Equal (t , 405 , status , "expected HTTP405 method not allowed" )
100+ assert .Equal (t , "Method Not Allowed\n " , result )
101101 })
102102}
103103
@@ -123,21 +123,21 @@ func TestPostMetric(t *testing.T) {
123123 body := "{{\n "
124124 expected := map [events.Event ]int {}
125125 status := testFunc (t , expected , body )
126- assert .Equal (t , status , http .StatusUnprocessableEntity , "status was not 422" )
126+ assert .Equal (t , http .StatusUnprocessableEntity , status , "status was not 422" )
127127 })
128128 t .Run ("POST value" , func (t * testing.T ) {
129129 body := "{\" mymetric\" : 1.0}"
130130 expected := map [events.Event ]int {{events .Metric , "mymetric|1" }: 1 }
131131 status := testFunc (t , expected , body )
132- assert .Equal (t , status , http .StatusOK , "status was not 200OK" )
132+ assert .Equal (t , http .StatusOK , status , "status was not 200OK" )
133133 })
134134 t .Run ("POST multi-metric" , func (t * testing.T ) {
135135 body := "{\" mymetric\" : 1.5, \" myothermetric\" : 2}"
136136 status := testFunc (t , map [events.Event ]int {
137137 {events .Metric , "mymetric|1.5" }: 1 ,
138138 {events .Metric , "myothermetric|2" }: 1 ,
139139 }, body )
140- assert .Equal (t , status , http .StatusOK , "status was not 200OK" )
140+ assert .Equal (t , http .StatusOK , status , "status was not 200OK" )
141141 })
142142}
143143
@@ -164,13 +164,13 @@ func TestPostEnableMaintenanceMode(t *testing.T) {
164164 req , _ := http .NewRequest ("POST" , "/v3/maintenance/enable" , strings .NewReader (body ))
165165 expected := map [events.Event ]int {events .GlobalEnterMaintenance : 1 }
166166 status := testFunc (t , expected , req )
167- assert .Equal (t , status , http .StatusOK , "status was not 200OK" )
167+ assert .Equal (t , http .StatusOK , status , "status was not 200OK" )
168168 })
169169 t .Run ("POST disable" , func (t * testing.T ) {
170170 req , _ := http .NewRequest ("POST" , "/v3/maintenance/enable" , nil )
171171 expected := map [events.Event ]int {events .GlobalEnterMaintenance : 1 }
172172 status := testFunc (t , expected , req )
173- assert .Equal (t , status , http .StatusOK , "status was not 200OK" )
173+ assert .Equal (t , http .StatusOK , status , "status was not 200OK" )
174174 })
175175}
176176
@@ -197,13 +197,13 @@ func TestPostDisableMaintenanceMode(t *testing.T) {
197197 req , _ := http .NewRequest ("POST" , "/v3/maintenance/disable" , strings .NewReader (body ))
198198 expected := map [events.Event ]int {events .GlobalExitMaintenance : 1 }
199199 status := testFunc (t , expected , req )
200- assert .Equal (t , status , http .StatusOK , "status was not 200OK" )
200+ assert .Equal (t , http .StatusOK , status , "status was not 200OK" )
201201 })
202202 t .Run ("POST disable" , func (t * testing.T ) {
203203 req , _ := http .NewRequest ("POST" , "/v3/maintenance/disable" , nil )
204204 expected := map [events.Event ]int {events .GlobalExitMaintenance : 1 }
205205 status := testFunc (t , expected , req )
206- assert .Equal (t , status , http .StatusOK , "status was not 200OK" )
206+ assert .Equal (t , http .StatusOK , status , "status was not 200OK" )
207207 })
208208}
209209
@@ -214,5 +214,5 @@ func TestGetPing(t *testing.T) {
214214 resp := w .Result ()
215215 defer resp .Body .Close ()
216216 status := resp .StatusCode
217- assert .Equal (t , status , 200 , "expected HTTP 200 OK" )
217+ assert .Equal (t , 200 , status , "expected HTTP 200 OK" )
218218}
0 commit comments