-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Functional test for paratoo integration #2971
- Loading branch information
Showing
8 changed files
with
1,651 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
src/integration-test/groovy/au/org/ala/fieldcapture/ParatooIntegrationSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
package au.org.ala.fieldcapture | ||
|
||
import au.org.ala.ws.service.WebService | ||
import org.apache.http.entity.ContentType | ||
import org.grails.testing.GrailsUnitTest | ||
import org.apache.http.HttpStatus | ||
import spock.lang.Stepwise | ||
import pages.RlpProjectPage | ||
|
||
@Stepwise | ||
// We need GrailsUnitTest because the WebService class has a dependency on grailsApplication.config | ||
// It slows startup down quite a bit though | ||
class ParatooIntegrationSpec extends StubbedCasSpec implements GrailsUnitTest { | ||
|
||
WebService webService | ||
|
||
def setupSpec(){ | ||
useDataSet("dataset3") | ||
} | ||
|
||
def cleanupSpec() { | ||
logout(browser) | ||
} | ||
|
||
def setup() { | ||
webService = new WebService(grailsApplication: getGrailsApplication()) | ||
} | ||
|
||
|
||
def "Add new data set in to project"() { | ||
|
||
setup: | ||
String token = tokenForUser('1') | ||
Map mintCollectionIdPayload = [ | ||
projectId:'monitorProject', | ||
protocol: [ | ||
id: 2, // Protocol 23 used to obtain representative data for this functional test | ||
version: 1 | ||
], | ||
surveyId: [ | ||
surveyType: 'soil-pit-characterisation-full', | ||
time: '2023-08-28T00:34:13.100Z', | ||
randNum: 46390249 | ||
] | ||
] | ||
Map collectionPayload = [ | ||
projectId:'monitorProject', | ||
protocol: [ | ||
id: 2, | ||
version: 1 | ||
], | ||
userId: '1', | ||
eventTime:'2023-08-28T00:28:15.272Z' | ||
] | ||
|
||
when: | ||
String url = testConfig.ecodata.baseUrl+'paratoo/mintCollectionId' | ||
Map headers = ["Authorization": "Bearer ${token}"] | ||
Map resp = webService.post(url, mintCollectionIdPayload, null, ContentType.APPLICATION_JSON, false, false, headers) | ||
|
||
String orgMintedIdentifier = resp.resp.orgMintedIdentifier | ||
|
||
then: | ||
resp.statusCode == HttpStatus.SC_OK | ||
|
||
orgMintedIdentifier != null | ||
|
||
when: | ||
collectionPayload.mintedCollectionId = orgMintedIdentifier | ||
url = testConfig.ecodata.baseUrl+'/paratoo/collection' | ||
resp = webService.post(url, collectionPayload, null, ContentType.APPLICATION_JSON, false, false, headers) | ||
|
||
then: | ||
resp.statusCode == HttpStatus.SC_OK | ||
resp.resp.success == true | ||
|
||
|
||
|
||
} | ||
|
||
|
||
def "Data from monitor will be used to create a data set summary in MERIT"() { | ||
when: "We view the created data set in the project" | ||
loginAsUser('1', browser) | ||
to RlpProjectPage, "monitorProject" | ||
openDataSetSummaryTab() | ||
|
||
then: "The data set is displayed" | ||
datasetDetails.dataSetSummaryCount() == 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
108 changes: 108 additions & 0 deletions
108
src/integration-test/resources/wiremock/mappings/monitorProtocol2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
{ | ||
"request": { | ||
"urlPath": "/monitor/protocols/2", | ||
"method": "GET" | ||
}, | ||
"response": { | ||
"status": 200, | ||
"headers": { | ||
"content-Type": "application/json" | ||
}, | ||
"jsonBody": { | ||
"data": { | ||
"id": 2, | ||
"attributes": { | ||
"identifier": "068d17e8-e042-ae42-1e42-d004fa2ef759", | ||
"name": "Soil Site Observation and Pit Characterisation", | ||
"module": "Soils", | ||
"endpointPrefix": "/soil-pit-characterisation-fulls", | ||
"version": 1, | ||
"description": "", | ||
"isWritable": true, | ||
"workflow": [ | ||
{ | ||
"modelName": "plot-layout" | ||
}, | ||
{ | ||
"modelName": "plot-visit" | ||
}, | ||
{ | ||
"modelName": "soil-pit-characterisation-full", | ||
"overrideDisplayName": "Soil Pit Location", | ||
"usesCustomComponent": true | ||
}, | ||
{ | ||
"modelName": "soil-landform-element", | ||
"overrideDisplayName": "Land Form Element", | ||
"usesCustomComponent": true | ||
}, | ||
{ | ||
"modelName": "soil-land-surface-phenomena", | ||
"overrideDisplayName": "Land Surface Phenomena & Soil Development", | ||
"usesCustomComponent": true | ||
}, | ||
{ | ||
"multiple": true, | ||
"required": false, | ||
"modelName": "microrelief-observation", | ||
"defaultHidden": true, | ||
"usesCustomComponent": true | ||
}, | ||
{ | ||
"multiple": true, | ||
"required": false, | ||
"modelName": "erosion-observation", | ||
"defaultHidden": true, | ||
"usesCustomComponent": true | ||
}, | ||
{ | ||
"multiple": true, | ||
"required": false, | ||
"modelName": "surface-coarse-fragments-observation", | ||
"defaultHidden": true | ||
}, | ||
{ | ||
"required": false, | ||
"modelName": "rock-outcrop-observation", | ||
"defaultHidden": true | ||
}, | ||
{ | ||
"modelName": "soil-pit-observation" | ||
}, | ||
{ | ||
"multiple": true, | ||
"modelName": "soil-horizon-observation", | ||
"usesCustomComponent": true, | ||
"newInstanceForRelationOnAttributes": [ | ||
"mottles", | ||
"coarse_fragments", | ||
"structure", | ||
"segregation", | ||
"voids", | ||
"pans", | ||
"cutans", | ||
"roots" | ||
] | ||
}, | ||
{ | ||
"modelName": "soil-classification", | ||
"newInstanceForRelationOnAttributes": [ | ||
"asc" | ||
] | ||
}, | ||
{ | ||
"multiple": true, | ||
"modelName": "soil-horizon-sample", | ||
"usesCustomComponent": true | ||
} | ||
], | ||
"isHidden": false, | ||
"next_prot_suggestion": "068d17e8-e042-ae42-1e42-d0065d7ec2e4", | ||
"createdAt": "2023-08-16T02:59:43.946Z", | ||
"updatedAt": "2023-08-16T02:59:43.946Z" | ||
} | ||
}, | ||
"meta": {} | ||
} | ||
} | ||
} |
Oops, something went wrong.