Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement mint legacy api endpoints #2201

Merged
merged 8 commits into from
May 31, 2024
Prev Previous commit
Next Next commit
Add bruno tests for legacy mint api endpoints
  • Loading branch information
alejandro-bulgaris-qcif committed May 30, 2024
commit 95550ab4cd90caec850ff4f52c23dd68b5274ca8
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
meta {
name: Create HARVEST Legacy Record
type: http
seq: 33
}

post {
url: {{host}}/default/rdmp/api/mint/harvest/rdmp
body: json
auth: none
}

headers {
Content-Type: application/json
Authorization: Bearer {{token}}
}

body:json {
{
"records": [
{
"harvest_id": "s123456",
"metadata": {
"data": {
"ID": "s123456",
"GIVEN_NAME": "Andrew",
"OTHER_NAMES": "",
"FAMILY_NAME": "S",
"PREF_NAME": "",
"HONORIFIC": "",
"EMAIL": "notAReal@email.edu.au",
"JOB_TITLE": "Assistant Professor",
"URI": "",
"NLA_PARTY_IDENTIFIER": "",
"ORCID": "0000-0001-7269-2286",
"PERSONAL_HOMEPAGE": "",
"STAFF_PROFILE_HOMEPAGE": "",
"DESCRIPTION": "",
"RESEARCH_ELEMENTS_USER_ID": "12345678"
}
}
}
]
}
}

tests {

test("Status code is 200", function () {
expect(res.getStatus()).to.equal(200);
});

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
meta {
name: Create HARVEST Legacy Record
type: http
seq: 34
}

post {
url: {{host}}/default/rdmp/api/records/harvest/rdmp
body: json
auth: none
}

headers {
Content-Type: application/json
Authorization: Bearer {{token}}
}

body:json {
{
"records": [
{
"harvestId": "s123456",
"recordRequest": {
"metadata": {
"ID": "s123456",
"GIVEN_NAME": "Andrew",
"OTHER_NAMES": "",
"FAMILY_NAME": "S",
"PREF_NAME": "",
"HONORIFIC": "",
"EMAIL": "notAReal@email.edu.au",
"JOB_TITLE": "Assistant Professor",
"URI": "",
"NLA_PARTY_IDENTIFIER": "",
"ORCID": "0000-0001-7269-2286",
"PERSONAL_HOMEPAGE": "",
"STAFF_PROFILE_HOMEPAGE": "",
"DESCRIPTION": "",
"RESEARCH_ELEMENTS_USER_ID": "12345678"
}
}
}
]
}
}

tests {

test("Status code is 200", function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some tests that check the response body is structured correctly?

expect(res.getStatus()).to.equal(200);
});

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
meta {
name: Get HARVEST Record-s Metadata
type: http
seq: 32
}

get {
url: {{host}}/default/rdmp/api/mint/harvest/search?harvestId=s123456&recordType=rdmp
body: none
auth: none
}

headers {
Authorization: Bearer {{token}}
~:
}

tests {
test("Status code is 200", function () {
expect(res.getStatus()).to.equal(200);
});

test("Title is correct", function () {
var jsonData = res.getBody();
expect(jsonData.GIVEN_NAME).to.eql("Andrew");
});
}
2 changes: 1 addition & 1 deletion typescript/api/services/ReportsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export module Services {
return this.getTranslateDatabaseResultToReportResult(dbResult, report);
} else {
let url = this.buildSolrParams(brand, req, report, start, rows, 'json');
const solrResults = await this.getSearchService().searchAdvanced(report.solrQuery.searchCore,null, url); //TODO pass type
const solrResults = await this.getSearchService().searchAdvanced(report.solrQuery.searchCore,null, url);
return this.getTranslateSolrResultToReportResult(solrResults, rows);
}
}
Expand Down