Skip to content

Commit f763147

Browse files
authored
Bugfix/remove auth from IT GET requests (#1345)
I noticed that Timeseries IT were sending the Authentication header to some of the get requests. Except for a couple places (which we should do a better job of documenting) all the GET shouldn't need auth. I pulled those changes into this "clean" PR.
1 parent 76aeb99 commit f763147

13 files changed

Lines changed: 14 additions & 87 deletions

cwms-data-api/src/test/java/cwms/cda/api/CatalogControllerTestIT.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,6 @@ void testFilterLocations() throws Exception{
550550
given()
551551
.log().ifValidationFails(LogDetail.ALL,true)
552552
.accept(Formats.JSON)
553-
.header("Authorization", user.toHeaderValue())
554553
.queryParam(OFFICE, officeId)
555554
.queryParam(LIKE, String.format("%s*", baseLocationName))
556555
.queryParam(UNIT_SYSTEM, UnitSystem.SI.getValue())
@@ -572,7 +571,6 @@ void testFilterLocations() throws Exception{
572571
given()
573572
.log().ifValidationFails(LogDetail.ALL,true)
574573
.accept(Formats.JSON)
575-
.header("Authorization", user.toHeaderValue())
576574
.queryParam(OFFICE, officeId)
577575
.queryParam(LIKE, stringToMatch)
578576
.queryParam(UNIT_SYSTEM, UnitSystem.SI.getValue())
@@ -593,7 +591,6 @@ void testFilterLocations() throws Exception{
593591
given()
594592
.log().ifValidationFails(LogDetail.ALL,true)
595593
.accept(Formats.JSON)
596-
.header("Authorization", user.toHeaderValue())
597594
.queryParam(OFFICE, officeId)
598595
.queryParam(LIKE, stringToMatch)
599596
.queryParam(LOCATION_KIND_LIKE, "^(BASIN)$")
@@ -615,7 +612,6 @@ void testFilterLocations() throws Exception{
615612
given()
616613
.log().ifValidationFails(LogDetail.ALL,true)
617614
.accept(Formats.JSON)
618-
.header("Authorization", user.toHeaderValue())
619615
.queryParam(OFFICE, officeId)
620616
.queryParam(LIKE, stringToMatch)
621617
.queryParam(LOCATION_KIND_LIKE, "^(STREAM)*$")
@@ -636,7 +632,6 @@ void testFilterLocations() throws Exception{
636632
given()
637633
.log().ifValidationFails(LogDetail.ALL,true)
638634
.accept(Formats.JSON)
639-
.header("Authorization", user.toHeaderValue())
640635
.queryParam(OFFICE, officeId)
641636
.queryParam(LIKE, stringToMatch)
642637
.queryParam(LOCATION_KIND_LIKE, "NOT:^(STREAM)*$")
@@ -656,7 +651,6 @@ void testFilterLocations() throws Exception{
656651
given()
657652
.log().ifValidationFails(LogDetail.ALL,true)
658653
.accept(Formats.JSON)
659-
.header("Authorization", user.toHeaderValue())
660654
.queryParam(OFFICE, officeId)
661655
.queryParam(LIKE, stringToMatch)
662656
.queryParam(LOCATION_KIND_LIKE, "NOT:^(STREAM)*$")
@@ -677,7 +671,6 @@ void testFilterLocations() throws Exception{
677671
given()
678672
.log().ifValidationFails(LogDetail.ALL,true)
679673
.accept(Formats.JSON)
680-
.header("Authorization", user.toHeaderValue())
681674
.queryParam(OFFICE, officeId)
682675
.queryParam(LIKE, stringToMatch)
683676
.queryParam(UNIT_SYSTEM, UnitSystem.SI.getValue())

cwms-data-api/src/test/java/cwms/cda/api/LevelsControllerTestIT.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@ void test_level_as_timeseries() throws Exception {
373373
.log().ifValidationFails(LogDetail.ALL,true)
374374
.accept(Formats.JSONV2)
375375
.contentType(Formats.JSONV2)
376-
.header("Authorization", user.toHeaderValue())
377376
.queryParam(Controllers.OFFICE, OFFICE)
378377
.queryParam(BEGIN, time.toInstant().toString())
379378
.queryParam(END, time.plusDays(effectiveDateCount).toInstant().toString())
@@ -413,7 +412,6 @@ void test_level_as_timeseries() throws Exception {
413412
.log().ifValidationFails(LogDetail.ALL,true)
414413
.accept(Formats.JSONV2)
415414
.contentType(Formats.JSONV2)
416-
.header("Authorization", user.toHeaderValue())
417415
.queryParam(Controllers.OFFICE, OFFICE)
418416
.queryParam(BEGIN, time.toInstant().toString())
419417
.queryParam(END, time.plusDays(effectiveDateCount).toInstant().toString())
@@ -493,7 +491,6 @@ void test_ts_backed_level_new_lrts_interval() throws Exception {
493491
.log().ifValidationFails(LogDetail.ALL,true)
494492
.accept(Formats.JSONV2)
495493
.contentType(Formats.JSONV2)
496-
.header("Authorization", user.toHeaderValue())
497494
.header(ApiServlet.IS_NEW_LRTS, false)
498495
.queryParam(Controllers.OFFICE, OFFICE)
499496
.queryParam(EFFECTIVE_DATE, time.toInstant().toString())
@@ -515,7 +512,6 @@ void test_ts_backed_level_new_lrts_interval() throws Exception {
515512
.log().ifValidationFails(LogDetail.ALL,true)
516513
.accept(Formats.JSONV2)
517514
.contentType(Formats.JSONV2)
518-
.header("Authorization", user.toHeaderValue())
519515
.header(ApiServlet.IS_NEW_LRTS, true)
520516
.queryParam(Controllers.OFFICE, OFFICE)
521517
.queryParam(EFFECTIVE_DATE, time.toInstant().toString())

cwms-data-api/src/test/java/cwms/cda/api/LocationControllerTestIT.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ void test_location_create_get_delete() throws Exception {
167167
given()
168168
.log().ifValidationFails(LogDetail.ALL,true)
169169
.accept(Formats.JSON)
170-
.header("Authorization", user.toHeaderValue())
171170
.queryParam(OFFICE, officeId)
172171
.when()
173172
.redirects().follow(true)
@@ -217,7 +216,6 @@ void test_location_create_get_delete() throws Exception {
217216
given()
218217
.log().ifValidationFails(LogDetail.ALL,true)
219218
.accept(Formats.JSON)
220-
.header("Authorization", user.toHeaderValue())
221219
.queryParam(OFFICE, officeId)
222220
.when()
223221
.redirects().follow(true)
@@ -314,7 +312,6 @@ void test_location_create_aliased() throws Exception {
314312
given()
315313
.log().ifValidationFails(LogDetail.ALL,true)
316314
.accept(Formats.JSON)
317-
.header("Authorization", user.toHeaderValue())
318315
.queryParam("office", officeId)
319316
.when()
320317
.redirects().follow(true)
@@ -329,7 +326,6 @@ void test_location_create_aliased() throws Exception {
329326
given()
330327
.log().ifValidationFails(LogDetail.ALL,true)
331328
.accept(Formats.JSON)
332-
.header("Authorization", user.toHeaderValue())
333329
.queryParam("office", officeId)
334330
.when()
335331
.redirects().follow(true)
@@ -374,7 +370,6 @@ void test_location_create_get_bad_units_delete() throws Exception {
374370
given()
375371
.log().ifValidationFails(LogDetail.ALL,true)
376372
.accept(Formats.JSON)
377-
.header("Authorization", user.toHeaderValue())
378373
.queryParam(OFFICE, officeId)
379374
.queryParam(UNIT, "m")
380375
.when()
@@ -408,7 +403,6 @@ void test_location_create_get_bad_units_delete() throws Exception {
408403
given()
409404
.log().ifValidationFails(LogDetail.ALL,true)
410405
.accept(Formats.JSON)
411-
.header("Authorization", user.toHeaderValue())
412406
.queryParam(OFFICE, officeId)
413407
.when()
414408
.redirects().follow(true)
@@ -449,7 +443,6 @@ void test_create_update() throws Exception {
449443
given()
450444
.log().ifValidationFails(LogDetail.ALL,true)
451445
.accept(Formats.JSON)
452-
.header("Authorization", user.toHeaderValue())
453446
.queryParam(OFFICE, user.getOperatingOffice())
454447
.when()
455448
.redirects().follow(true)
@@ -489,7 +482,6 @@ void test_create_update() throws Exception {
489482
given()
490483
.log().ifValidationFails(LogDetail.ALL,true)
491484
.accept(Formats.JSON)
492-
.header("Authorization", user.toHeaderValue())
493485
.queryParam(OFFICE, user.getOperatingOffice())
494486
.when()
495487
.redirects().follow(true)

cwms-data-api/src/test/java/cwms/cda/api/LocationGroupControllerTestIT.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,6 @@ void test_post_does_not_write_on_assigned_location_fail(String format) throws Ex
15241524
given()
15251525
.log().ifValidationFails(LogDetail.ALL,true)
15261526
.accept(format)
1527-
.header("Authorization", user.toHeaderValue())
15281527
.queryParam(OFFICE, officeId)
15291528
.queryParam(CATEGORY_ID, cat.getId())
15301529
.when()
@@ -1562,7 +1561,6 @@ void test_post_does_not_write_on_assigned_location_fail(String format) throws Ex
15621561
given()
15631562
.log().ifValidationFails(LogDetail.ALL,true)
15641563
.accept(format)
1565-
.header("Authorization", user.toHeaderValue())
15661564
.queryParam(OFFICE, officeId)
15671565
.queryParam(CATEGORY_ID, cat.getId())
15681566
.when()

cwms-data-api/src/test/java/cwms/cda/api/LocationKindControllerIT.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ void test_get_location_kinds(String format) throws Exception {
6262
.log().ifValidationFails(LogDetail.ALL,true)
6363
.accept(format)
6464
.contentType(Formats.JSONV2)
65-
.header("Authorization", user.toHeaderValue())
6665
.when()
6766
.redirects().follow(true)
6867
.redirects().max(3)
@@ -77,7 +76,6 @@ void test_get_location_kinds(String format) throws Exception {
7776
.log().ifValidationFails(LogDetail.ALL,true)
7877
.accept(format)
7978
.contentType(Formats.JSONV2)
80-
.header("Authorization", user.toHeaderValue())
8179
.queryParam(NAMES, randomName)
8280
.queryParam(OFFICE, officeId)
8381
.queryParam(LOCATION_KIND_LIKE, "SITE")
@@ -116,7 +114,6 @@ void testLocationKindLike(String format) throws Exception {
116114
.log().ifValidationFails(LogDetail.ALL,true)
117115
.accept(format)
118116
.contentType(Formats.JSONV2)
119-
.header("Authorization", user.toHeaderValue())
120117
.queryParam(LOCATION_KIND_LIKE, "BASIN")
121118
.when()
122119
.redirects().follow(true)

cwms-data-api/src/test/java/cwms/cda/api/SpecifiedLevelIdIT.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ void test_create_read_delete(String format) throws JsonProcessingException {
7878
.log().ifValidationFails(LogDetail.ALL,true)
7979
.accept(format)
8080
.contentType(Formats.JSONV2)
81-
.header("Authorization", user.toHeaderValue())
8281
.queryParam("office", OFFICE)
8382
.queryParam(Controllers.TEMPLATE_ID_MASK, specifiedLevel.getId())
8483
.when()
@@ -114,7 +113,6 @@ void test_create_read_delete(String format) throws JsonProcessingException {
114113
.log().ifValidationFails(LogDetail.ALL,true)
115114
.accept(format)
116115
.contentType(Formats.JSONV2)
117-
.header("Authorization", user.toHeaderValue())
118116
.queryParam("office", OFFICE)
119117
.queryParam(Controllers.TEMPLATE_ID_MASK, specifiedLevel.getId())
120118
.when()
@@ -174,7 +172,6 @@ void test_update() throws JsonProcessingException {
174172
.log().ifValidationFails(LogDetail.ALL,true)
175173
.accept(Formats.JSONV2)
176174
.contentType(Formats.JSONV2)
177-
.header("Authorization", user.toHeaderValue())
178175
.queryParam(Controllers.OFFICE, OFFICE)
179176
.queryParam(Controllers.TEMPLATE_ID_MASK, newId)
180177
.when()

cwms-data-api/src/test/java/cwms/cda/api/TimeSeriesFilteredControllerTestIT.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ void test_filter_nulls(String format) throws Exception {
7070
.config(RestAssured.config().jsonConfig(jsonConfig().numberReturnType(JsonPathConfig.NumberReturnType.DOUBLE)))
7171
.log().ifValidationFails(LogDetail.ALL,true)
7272
.accept(format)
73-
.header("Authorization",user.toHeaderValue())
7473
.queryParam(Controllers.OFFICE, officeId)
7574
.queryParam(Controllers.UNIT,"cfs")
7675
.queryParam(Controllers.NAME, ts.get(Controllers.NAME).asText())
@@ -95,7 +94,6 @@ void test_filter_nulls(String format) throws Exception {
9594
.config(RestAssured.config().jsonConfig(jsonConfig().numberReturnType(JsonPathConfig.NumberReturnType.DOUBLE)))
9695
.log().ifValidationFails(LogDetail.ALL,true)
9796
.accept(format)
98-
.header("Authorization",user.toHeaderValue())
9997
.queryParam(Controllers.OFFICE, officeId)
10098
.queryParam(Controllers.UNIT,"cfs")
10199
.queryParam(Controllers.NAME, ts.get(Controllers.NAME).asText())
@@ -162,7 +160,6 @@ void test_min_value(String format) throws Exception {
162160
.config(RestAssured.config().jsonConfig(jsonConfig().numberReturnType(JsonPathConfig.NumberReturnType.DOUBLE)))
163161
.log().ifValidationFails(LogDetail.ALL,true)
164162
.accept(format)
165-
.header("Authorization",user.toHeaderValue())
166163
.queryParam(Controllers.OFFICE, officeId)
167164
.queryParam(Controllers.UNIT,"cfs")
168165
.queryParam(Controllers.NAME, ts.get(Controllers.NAME).asText())
@@ -227,7 +224,6 @@ void test_max_value(String format) throws Exception {
227224
.config(RestAssured.config().jsonConfig(jsonConfig().numberReturnType(JsonPathConfig.NumberReturnType.DOUBLE)))
228225
.log().ifValidationFails(LogDetail.ALL,true)
229226
.accept(format)
230-
.header("Authorization",user.toHeaderValue())
231227
.queryParam(Controllers.OFFICE, officeId)
232228
.queryParam(Controllers.UNIT,"cfs")
233229
.queryParam(Controllers.NAME, ts.get(Controllers.NAME).asText())
@@ -292,7 +288,6 @@ void test_min_max_value_combined(String format) throws Exception {
292288
.config(RestAssured.config().jsonConfig(jsonConfig().numberReturnType(JsonPathConfig.NumberReturnType.DOUBLE)))
293289
.log().ifValidationFails(LogDetail.ALL,true)
294290
.accept(format)
295-
.header("Authorization",user.toHeaderValue())
296291
.queryParam(Controllers.OFFICE, officeId)
297292
.queryParam(Controllers.UNIT,"cfs")
298293
.queryParam(Controllers.NAME, ts.get(Controllers.NAME).asText())
@@ -357,7 +352,6 @@ void test_all_filters_combined(String format) throws Exception {
357352
.config(RestAssured.config().jsonConfig(jsonConfig().numberReturnType(JsonPathConfig.NumberReturnType.DOUBLE)))
358353
.log().ifValidationFails(LogDetail.ALL,true)
359354
.accept(format)
360-
.header("Authorization",user.toHeaderValue())
361355
.queryParam(Controllers.OFFICE, officeId)
362356
.queryParam(Controllers.UNIT,"cfs")
363357
.queryParam(Controllers.NAME, ts.get(Controllers.NAME).asText())

cwms-data-api/src/test/java/cwms/cda/api/TimeSeriesGroupControllerTestIT.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,7 +1463,6 @@ void test_patch_district_permission(String format) throws Exception {
14631463
.log().ifValidationFails(LogDetail.ALL, true)
14641464
.accept(format)
14651465
.contentType(Formats.JSONV1)
1466-
.header("Authorization", user.toHeaderValue())
14671466
.queryParam(OFFICE, CWMS_OFFICE) //office
14681467
.queryParam(GROUP_OFFICE_ID, CWMS_OFFICE)
14691468
.queryParam(CATEGORY_OFFICE_ID, CWMS_OFFICE)
@@ -1500,7 +1499,6 @@ void test_patch_district_permission(String format) throws Exception {
15001499
.log().ifValidationFails(LogDetail.ALL, true)
15011500
.accept(format)
15021501
.contentType(Formats.JSONV1)
1503-
.header("Authorization", user.toHeaderValue())
15041502
.queryParam(OFFICE, officeId)
15051503
.queryParam(GROUP_OFFICE_ID, CWMS_OFFICE)
15061504
.queryParam(CATEGORY_OFFICE_ID, CWMS_OFFICE)

0 commit comments

Comments
 (0)