diff --git a/tests/k6/tests/serviceowner/all-tests.js b/tests/k6/tests/serviceowner/all-tests.js index 86dee427f..0f052a4f4 100644 --- a/tests/k6/tests/serviceowner/all-tests.js +++ b/tests/k6/tests/serviceowner/all-tests.js @@ -8,6 +8,7 @@ import { default as dialogCreateInvalidActionCount } from './dialogCreateInvalid import { default as dialogCreateInvalidProcess } from './dialogCreateInvalidProcess.js'; import { default as dialogCreatePatchDelete } from './dialogCreatePatchDelete.js'; import { default as dialogCreateUpdatePatchDeleteCorrespondenceResource } from './dialogCreateUpdatePatchDeleteCorrespondenceResource.js'; +import { default as dialogDetails } from './dialogDetails.js'; import { default as dialogSearch } from './dialogSearch.js'; import { default as dialogUpdateActivity } from './dialogUpdateActivity.js'; @@ -21,6 +22,7 @@ export default function() { dialogCreateInvalidProcess(); dialogCreatePatchDelete(); dialogCreateUpdatePatchDeleteCorrespondenceResource(); + dialogDetails(); dialogSearch(); dialogUpdateActivity(); } diff --git a/tests/k6/tests/serviceowner/dialogDetails.js b/tests/k6/tests/serviceowner/dialogDetails.js new file mode 100644 index 000000000..622a1a3c7 --- /dev/null +++ b/tests/k6/tests/serviceowner/dialogDetails.js @@ -0,0 +1,36 @@ +import { + describe, + expect, + expectStatusFor, + getSO, + postSO +} from '../../common/testimports.js' +import {default as dialogToInsert} from './testdata/01-create-dialog.js'; +import { getDefaultEnduserSsn } from "../../common/token.js"; + +export default function () { + + let dialogId = null; + let endUserId = "urn:altinn:person:identifier-no:" + getDefaultEnduserSsn(); + let invalidEndUserId = "urn:altinn:person:identifier-no:08895699684"; + + describe('Perform dialog create', () => { + let r = postSO('dialogs', dialogToInsert()); + expectStatusFor(r).to.equal(201); + expect(r, 'response').to.have.validJsonBody(); + + dialogId = r.json(); + }); + + describe('Perform dialog get with endUserId', () => { + let r = getSO('dialogs/' + dialogId + '?endUserId=' + endUserId); + expectStatusFor(r).to.equal(200); + expect(r, 'response').to.have.validJsonBody(); + expect(r.json(), 'dialog').to.have.property("id").to.equal(dialogId); + }); + + describe('Perform dialog get with invalid endUserId', () => { + let r = getSO('dialogs/' + dialogId + '?endUserId=' + invalidEndUserId); + expectStatusFor(r).to.equal(404); + }); +} diff --git a/tests/k6/tests/serviceowner/dialogSearch.js b/tests/k6/tests/serviceowner/dialogSearch.js index d619bdac6..73233d71c 100644 --- a/tests/k6/tests/serviceowner/dialogSearch.js +++ b/tests/k6/tests/serviceowner/dialogSearch.js @@ -21,7 +21,7 @@ import { import { default as dialogToInsert } from './testdata/01-create-dialog.js'; -import { getDefaultEnduserOrgNo } from "../../common/token.js"; +import { getDefaultEnduserOrgNo, getDefaultEnduserSsn } from "../../common/token.js"; export default function () { @@ -37,6 +37,7 @@ export default function () { let senderNameToSearchFor = uuidv4() let auxParty = "urn:altinn:organization:identifier-no:" + getDefaultEnduserOrgNo(); let auxResource = "urn:altinn:resource:ttd-dialogporten-automated-tests-2"; // This must exist in Resource Registry + let endUserId = "urn:altinn:person:identifier-no:" + getDefaultEnduserSsn(); let titleForDueAtItem = uuidv4(); let titleForExpiresAtItem = uuidv4(); let titleForVisibleFromItem = uuidv4(); @@ -191,6 +192,23 @@ export default function () { expect(r.json(), 'response json').to.have.property("items").with.lengthOf(1); expect(r.json().items[0], 'process').to.have.property("process").that.equals(processToSeachFor); }) + + describe('List with enduserid', () => { + let r = getSO('dialogs/?CreatedAfter=' + createdAfter + '&EndUserId=' + endUserId + '&ServiceResource=' + auxResource); + expectStatusFor(r).to.equal(200); + expect(r, 'response').to.have.validJsonBody(); + expect(r.json(), 'response json').to.have.property("items").with.lengthOf(1); + expect(r.json().items[0], 'party').to.have.property("serviceResource").that.equals(auxResource); + }) + + describe('List with invalid enduserid', () => { + let invalidEndUserId = "urn:altinn:person:identifier-no:08895699684"; + let r = getSO('dialogs/?CreatedAfter=' + createdAfter + '&EndUserId=' + invalidEndUserId + '&ServiceResource=' + auxResource); + expectStatusFor(r).to.equal(200); + expect(r, 'response').to.have.validJsonBody(); + expect(r.json(), 'response json').not.to.have.property("items"); + }) + describe("Cleanup", () => { dialogIds.forEach((d) => { let r = purgeSO("dialogs/" + d);