Skip to content

Commit

Permalink
[MODAUD-174] - minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
azizbekxm committed Nov 14, 2023
1 parent d32bc03 commit 6aef666
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.folio.rest.impl;

import static io.restassured.RestAssured.get;
import static io.restassured.RestAssured.given;
import static org.folio.utils.EntityUtils.ORDER_ID;
import static org.folio.utils.EntityUtils.ORDER_LINE_ID;
Expand Down Expand Up @@ -101,10 +102,12 @@ void shouldReturnOrderLineEventsOnGetByOrderLineId() {

orderLineEventDao.save(orderLineAuditEvent, TENANT_ID);

given().header(CONTENT_TYPE).header(TENANT).header(PERMS).get(ACQ_AUDIT_ORDER_LINE_PATH+ INVALID_ID).then().log().all().statusCode(200)
given().header(CONTENT_TYPE).header(TENANT).header(PERMS).get(ACQ_AUDIT_ORDER_LINE_PATH+ INVALID_ID)
.then().log().all().statusCode(200)
.body(containsString("orderLineAuditEvents")).body(containsString("totalItems"));

given().header(CONTENT_TYPE).header(TENANT).header(PERMS).get(ACQ_AUDIT_ORDER_LINE_PATH+ ORDER_LINE_ID).then().log().all().statusCode(200)
given().header(CONTENT_TYPE).header(TENANT).header(PERMS).get(ACQ_AUDIT_ORDER_LINE_PATH+ ORDER_LINE_ID)
.then().log().all().statusCode(200)
.body(containsString(ORDER_LINE_ID));

given().header(CONTENT_TYPE).header(TENANT).header(PERMS).get(ACQ_AUDIT_ORDER_LINE_PATH+ ORDER_LINE_ID +"?limit=1").then().log().all().statusCode(200)
Expand All @@ -125,27 +128,33 @@ void shouldReturnPieceEventsOnGetByPieceId() {
PieceAuditEvent pieceAuditEvent = new PieceAuditEvent()
.withId(UUID.randomUUID().toString())
.withAction(PieceAuditEvent.Action.CREATE)
.withPieceId(PIECE_ID)
.withPieceId("123e4567-e89b-12d3-a456-426614174005")
.withUserId(UUID.randomUUID().toString())
.withEventDate(new Date())
.withActionDate(new Date())
.withPieceSnapshot(jsonObject);

pieceEventsDao.save(pieceAuditEvent, TENANT_ID);

given().header(CONTENT_TYPE).header(TENANT).header(PERMS).get(ACQ_AUDIT_PIECE_PATH + INVALID_ID).then().log().all().statusCode(200)
given().header(CONTENT_TYPE).header(TENANT).header(PERMS)
.get(ACQ_AUDIT_PIECE_PATH + INVALID_ID)
.then().log().all().statusCode(200)
.body(containsString("pieceAuditEvents")).body(containsString("totalItems"));

// given().header(CONTENT_TYPE).header(TENANT).header(PERMS).get(ACQ_AUDIT_PIECE_PATH + PIECE_ID).then().log().all().statusCode(200)
// .body(containsString(PIECE_ID));
given().header(CONTENT_TYPE).header(TENANT).header(PERMS)
.get(ACQ_AUDIT_PIECE_PATH + "123e4567-e89b-12d3-a456-426614174005")
.then().log().all().statusCode(200)
.body(containsString("123e4567-e89b-12d3-a456-426614174005"));

// given().header(CONTENT_TYPE).header(TENANT).header(PERMS).get(ACQ_AUDIT_PIECE_PATH + PIECE_ID +"?limit=1").then().log().all().statusCode(200)
// .body(containsString(PIECE_ID));
//
// given().header(CONTENT_TYPE).header(TENANT).header(PERMS).get(ACQ_AUDIT_PIECE_PATH + PIECE_ID +"?sortBy=action_date").then().log().all().statusCode(200)
// .body(containsString(PIECE_ID));
given().header(CONTENT_TYPE).header(TENANT).header(PERMS)
.get(ACQ_AUDIT_PIECE_PATH + "123e4567-e89b-12d3-a456-426614174005" +"?limit=1")
.then().log().all().statusCode(200)
.body(containsString("123e4567-e89b-12d3-a456-426614174005"));

given().header(CONTENT_TYPE).header(TENANT).header(PERMS).get(ACQ_AUDIT_PIECE_PATH + "123e4567-e89b-12d3-a456-426614174005" +"?sortBy=action_date").then().log().all().statusCode(200)
.body(containsString("123e4567-e89b-12d3-a456-426614174005"));

given().header(CONTENT_TYPE).header(TENANT).header(PERMS).get(ACQ_AUDIT_PIECE_PATH + PIECE_ID + 123).then().log().all().statusCode(500)
given().header(CONTENT_TYPE).header(TENANT).header(PERMS).get(ACQ_AUDIT_PIECE_PATH + "123e4567-e89b-12d3-a456-426614174005" + 123).then().log().all().statusCode(500)
.body(containsString("UUID string too large"));
}

Expand Down Expand Up @@ -184,15 +193,15 @@ void shouldReturnPieceEventsStatusChangeHistoryGetByPieceId() {
.body(containsString(id5));

given().header(CONTENT_TYPE).header(TENANT).header(PERMS)
.get(ACQ_AUDIT_PIECE_PATH + PIECE_ID + ACQ_AUDIT_PIECE_STATUS_CHANGE_HISTORY_PATH +"?limit=1")
.get(ACQ_AUDIT_PIECE_PATH + ORDER_ID + ACQ_AUDIT_PIECE_STATUS_CHANGE_HISTORY_PATH +"?limit=1")
.then().log().all().statusCode(200)
.body(containsString(PIECE_ID))
.body(containsString(ORDER_ID))
.body(containsString(id1));

given().header(CONTENT_TYPE).header(TENANT).header(PERMS)
.get(ACQ_AUDIT_PIECE_PATH + PIECE_ID + ACQ_AUDIT_PIECE_STATUS_CHANGE_HISTORY_PATH +"?sortBy=action_date")
.get(ACQ_AUDIT_PIECE_PATH + ORDER_ID + ACQ_AUDIT_PIECE_STATUS_CHANGE_HISTORY_PATH +"?sortBy=action_date")
.then().log().all().statusCode(200)
.body(containsString(PIECE_ID))
.body(containsString(ORDER_ID))
.body(containsString(id1))
.body(containsString(id3))
.body(containsString(id5));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static PieceAuditEvent createPieceAuditEvent(String id, String status) {
return new PieceAuditEvent()
.withId(id)
.withAction(PieceAuditEvent.Action.CREATE)
.withPieceId(PIECE_ID)
.withPieceId("123e4567-e89b-12d3-a456-426614174005")
.withUserId(UUID.randomUUID().toString())
.withEventDate(new Date())
.withActionDate(new Date())
Expand Down

0 comments on commit 6aef666

Please sign in to comment.