@@ -29,13 +29,13 @@ func TestHttpSetSEKPrice(t *testing.T) {
2929 version := strings .Contains (string (body ), `"version": "SignalA_v1.0"` )
3030 // check results from above
3131 if value != true {
32- t .Errorf ("expected the statment to be true!" )
32+ t .Errorf ("expected the statement to be true!" )
3333 }
3434 if unit != true {
3535 t .Errorf ("expected the unit statement to be true!" )
3636 }
3737 if version != true {
38- t .Errorf ("expected the version statment to be true!" )
38+ t .Errorf ("expected the version statement to be true!" )
3939 }
4040 // Bad test case: default part of code
4141 w = httptest .NewRecorder ()
@@ -97,13 +97,13 @@ func TestHttpSetMinTemp(t *testing.T) {
9797 version := strings .Contains (string (body ), `"version": "SignalA_v1.0"` )
9898 // check the result from above
9999 if value != true {
100- t .Errorf ("expected the statment to be true!" )
100+ t .Errorf ("expected the statement to be true!" )
101101 }
102102 if unit != true {
103103 t .Errorf ("expected the unit statement to be true!" )
104104 }
105105 if version != true {
106- t .Errorf ("expected the version statment to be true!" )
106+ t .Errorf ("expected the version statement to be true!" )
107107 }
108108 // bad test case: default part of code
109109 // force the case to hit default statement but alter the method
@@ -165,13 +165,13 @@ func TestHttpSetMaxTemp(t *testing.T) {
165165 unit := strings .Contains (string (body ), `"unit": "Celsius"` )
166166 version := strings .Contains (string (body ), `"version": "SignalA_v1.0"` )
167167 if value != true {
168- t .Errorf ("expected the statment to be true!" )
168+ t .Errorf ("expected the statement to be true!" )
169169 }
170170 if unit != true {
171171 t .Errorf ("expected the unit statement to be true!" )
172172 }
173173 if version != true {
174- t .Errorf ("expected the version statment to be true!" )
174+ t .Errorf ("expected the version statement to be true!" )
175175 }
176176 // bad test case: default part of code
177177
@@ -233,13 +233,13 @@ func TestHttpSetMinPrice(t *testing.T) {
233233 unit := strings .Contains (string (body ), `"unit": "SEK"` )
234234 version := strings .Contains (string (body ), `"version": "SignalA_v1.0"` )
235235 if value != true {
236- t .Errorf ("expected the statment to be true!" )
236+ t .Errorf ("expected the statement to be true!" )
237237 }
238238 if unit != true {
239239 t .Errorf ("expected the unit statement to be true!" )
240240 }
241241 if version != true {
242- t .Errorf ("expected the version statment to be true!" )
242+ t .Errorf ("expected the version statement to be true!" )
243243 }
244244 // bad test case: default part of code
245245
@@ -303,13 +303,13 @@ func TestHttpSetMaxPrice(t *testing.T) {
303303 version := strings .Contains (string (body ), `"version": "SignalA_v1.0"` )
304304
305305 if value != true {
306- t .Errorf ("expected the statment to be true!" )
306+ t .Errorf ("expected the statement to be true!" )
307307 }
308308 if unit != true {
309309 t .Errorf ("expected the unit statement to be true!" )
310310 }
311311 if version != true {
312- t .Errorf ("expected the version statment to be true!" )
312+ t .Errorf ("expected the version statement to be true!" )
313313 }
314314 // bad test case: default part of code
315315
@@ -377,13 +377,13 @@ func TestHttpSetDesiredTemp(t *testing.T) {
377377 version := strings .Contains (string (body ), `"version": "SignalA_v1.0"` )
378378
379379 if value != true {
380- t .Errorf ("expected the statment to be true!" )
380+ t .Errorf ("expected the statement to be true!" )
381381 }
382382 if unit != true {
383383 t .Errorf ("expected the unit statement to be true!" )
384384 }
385385 if version != true {
386- t .Errorf ("expected the version statment to be true!" )
386+ t .Errorf ("expected the version statement to be true!" )
387387 }
388388 // bad test case: default part of code
389389
@@ -450,13 +450,13 @@ func TestHttpSetUserTemp(t *testing.T) {
450450 version := strings .Contains (string (body ), `"version": "SignalA_v1.0"` )
451451
452452 if value != true {
453- t .Errorf ("expected the statment to be true!" )
453+ t .Errorf ("expected the statement to be true!" )
454454 }
455455 if unit != true {
456456 t .Errorf ("expected the unit statement to be true!" )
457457 }
458458 if version != true {
459- t .Errorf ("expected the version statment to be true!" )
459+ t .Errorf ("expected the version statement to be true!" )
460460 }
461461 // bad test case: default part of code
462462
@@ -477,9 +477,9 @@ func TestHttpSetRegion(t *testing.T) {
477477
478478 // creates a fake request body with JSON data
479479 w := httptest .NewRecorder ()
480- fakebody := bytes .NewReader ([]byte (`{"value": 1, "unit": "RegionPoint", " version": "SignalA_v1.0"}` )) // converts the Jason data so it can be read
481- r := httptest .NewRequest ("PUT" , "http://localhost:8670/Comfortstat/Set%20Values/Region" , fakebody ) // simulating a put request from a user to update the min temp
482- r .Header .Set ("Content-Type" , "application/json" ) // basic setup to prevent the request to be rejected.
480+ fakebody := bytes .NewReader ([]byte (`{"value": 1, "version": "SignalA_v1.0"}` )) // converts the Jason data so it can be read
481+ r := httptest .NewRequest ("PUT" , "http://localhost:8670/Comfortstat/Set%20Values/Region" , fakebody ) // simulating a put request from a user to update the min temp
482+ r .Header .Set ("Content-Type" , "application/json" ) // basic setup to prevent the request to be rejected.
483483 goodStatusCode := 200
484484
485485 ua .httpSetRegion (w , r )
@@ -494,7 +494,7 @@ func TestHttpSetRegion(t *testing.T) {
494494
495495 // creates a fake request body with JSON data
496496 w = httptest .NewRecorder ()
497- fakebody = bytes .NewReader ([]byte (`{"123, "unit": "RegionPoint", " version": "SignalA_v1.0"}` )) // converts the Jason data so it can be read
497+ fakebody = bytes .NewReader ([]byte (`{"123, "version": "SignalA_v1.0"}` )) // converts the Jason data so it can be read
498498 r = httptest .NewRequest ("PUT" , "http://localhost:8670/Comfortstat/Set%20Values/Region" , fakebody ) // simulating a put request from a user to update the min temp
499499 r .Header .Set ("Content-Type" , "application/json" ) // basic setup to prevent the request to be rejected.
500500
@@ -519,17 +519,13 @@ func TestHttpSetRegion(t *testing.T) {
519519 body , _ := io .ReadAll (resp .Body )
520520 // this is a simple check if the JSON response contains the specific value/unit/version
521521 value := strings .Contains (string (body ), `"value": 1` )
522- unit := strings .Contains (string (body ), `"unit": "RegionPoint"` )
523522 version := strings .Contains (string (body ), `"version": "SignalA_v1.0"` )
524523
525524 if value != true {
526- t .Errorf ("expected the statment to be true!" )
527- }
528- if unit != true {
529- t .Errorf ("expected the unit statement to be true!" )
525+ t .Errorf ("expected the statement to be true!" )
530526 }
531527 if version != true {
532- t .Errorf ("expected the version statment to be true!" )
528+ t .Errorf ("expected the version statement to be true!" )
533529 }
534530 // bad test case: default part of code
535531
0 commit comments