Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

List Multiple Report Definitions IT #276

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -276,4 +276,45 @@ class ReportDefinitionIT : PluginRestTestCase() {
)
Thread.sleep(100)
}

fun `test listing multiple report definitions`() {
val reportDefinitionRequest = constructReportDefinitionRequest()
val reportDefinitionResponse = executeRequest(
RestRequest.Method.POST.name,
"$BASE_REPORTS_URI/definition",
reportDefinitionRequest,
RestStatus.OK.status
)
val reportDefinitionId = reportDefinitionResponse.get("reportDefinitionId").asString
Assert.assertNotNull("reportDefinitionId should be generated", reportDefinitionId)
Thread.sleep(100)

val secondReportDefinitionRequest = constructReportDefinitionRequest(name = "new report definition")
val secondReportDefinitionResponse = executeRequest(
RestRequest.Method.POST.name,
"$BASE_REPORTS_URI/definition",
secondReportDefinitionRequest,
RestStatus.OK.status
)
val newReportDefinitionId = secondReportDefinitionResponse.get("reportDefinitionId").asString
Assert.assertNotNull("reportDefinitionId should be generated", newReportDefinitionId)
Thread.sleep(1000)
val listReportDefinitions = executeRequest(
RestRequest.Method.GET.name,
"$BASE_REPORTS_URI/definitions",
"",
RestStatus.OK.status
)
val totalHits = listReportDefinitions.get("totalHits").asInt
Assert.assertEquals(totalHits, 2)
val reportDefinitionsList = listReportDefinitions.get("reportDefinitionDetailsList").asJsonArray
Assert.assertEquals(
reportDefinitionId,
reportDefinitionsList[0].asJsonObject.get("id").asString
)
Assert.assertEquals(
newReportDefinitionId,
reportDefinitionsList[1].asJsonObject.get("id").asString
)
}
}