Skip to content

Commit

Permalink
test: update cucumber tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwwinter committed Mar 22, 2024
1 parent 8333ad0 commit 1851fcd
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ sealed class ReportCalculationOutcome {
}

data class ReportCalculation(
@JsonProperty("_id")
val id: String,
val report: DomainReference,
var status: ReportCalculationStatus,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.aamdigital.aambackendservice.reporting.domain

import com.aamdigital.aambackendservice.domain.DomainReference
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.ObjectMapper
import java.security.MessageDigest

data class ReportData(
@JsonProperty("_id")
val id: String,
val report: DomainReference,
val calculation: DomainReference,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.aamdigital.aambackendservice.reporting.report.storage
package com.aamdigital.aambackendservice.reporting.storage

import com.aamdigital.aambackendservice.couchdb.dto.CouchDbChange
import com.aamdigital.aambackendservice.domain.DomainReference
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.aamdigital.aambackendservice.reporting.report.storage
package com.aamdigital.aambackendservice.reporting.storage

import com.aamdigital.aambackendservice.couchdb.core.CouchDbStorage
import com.aamdigital.aambackendservice.couchdb.core.getQueryParamsAllDocs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.aamdigital.aambackendservice.reporting.report.storage
package com.aamdigital.aambackendservice.reporting.storage

import com.aamdigital.aambackendservice.couchdb.core.CouchDbStorage
import com.aamdigital.aambackendservice.couchdb.core.getQueryParamsAllDocs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,39 @@ Feature: the report calculation endpoint persist to database
Then the client receives an json array
Then the client receives status code of 200
Then the client receives array with 0 elements

Scenario: client makes call to GET /reporting/report-calculation/report/ReportConfig:1 and receives one element
Given database app is created
Given database report-calculation is created
Given document ReportConfig:1 is stored in database app
Given document ReportCalculation:1 is stored in database report-calculation
Given signed in as client dummy-client with secret client-secret in realm dummy-realm
When the client calls GET /v1/reporting/report-calculation/report/ReportConfig:1
Then the client receives an json array
Then the client receives status code of 200
Then the client receives array with 1 elements

Scenario: client makes call to GET /reporting/report-calculation/ReportCalculation:1 and receives element
Given database app is created
Given database report-calculation is created
Given document ReportConfig:1 is stored in database app
Given document ReportCalculation:1 is stored in database report-calculation
Given signed in as client dummy-client with secret client-secret in realm dummy-realm
When the client calls GET /v1/reporting/report-calculation/ReportCalculation:1
Then the client receives an json object
Then the client receives status code of 200
Then the client receives value FINISHED_SUCCESS for property status
Then the client receives value ReportCalculation:1 for property _id

Scenario: client makes call to GET /reporting/report-calculation/ReportCalculation:1/data and receives data
Given database app is created
Given database report-calculation is created
Given document ReportConfig:1 is stored in database app
Given document ReportCalculation:1 is stored in database report-calculation
Given document ReportData:1 is stored in database report-calculation
Given signed in as client dummy-client with secret client-secret in realm dummy-realm
When the client calls GET /v1/reporting/report-calculation/ReportCalculation:1/data
Then the client receives an json object
Then the client receives status code of 200
Then the client receives value 22cfbb91fcbff5a2e0755cc26567a81078898dfe939d07c9745149f45863ca31 for property dataHash
Then the client receives value ReportData:1 for property _id
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"_id": "ReportCalculation:1",
"report": {
"id": "ReportConfig:1"
},
"status": "FINISHED_SUCCESS",
"startDate": "2024-03-20T11:42:08.571",
"endDate": "2024-03-20T11:42:08.7",
"outcome": {
"result_hash": "000"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"_id": "ReportData:1",
"report": {
"id": "ReportConfig:1"
},
"calculation": {
"id": "ReportCalculation:1"
},
"data": [
{
"foo": "bar",
"bar": "foo"
}
],
"dataHash": "000"
}

0 comments on commit 1851fcd

Please sign in to comment.