diff --git a/test/Jobs.js b/test/Jobs.js index 885c60c82..f75290f84 100644 --- a/test/Jobs.js +++ b/test/Jobs.js @@ -15,76 +15,82 @@ let accessTokenAdminIngestor = null, let datasetPid1 = null, datasetPid2 = null, datasetPid3 = null, - jobId1 = null, - encodedJobId1 = null, - jobId2 = null, - encodedJobId2 = null, - jobId3 = null, - encodedJobId3 = null, - jobId4 = null, - encodedJobId4 = null, - jobId5 = null, - encodedJobId5 = null, - jobId6 = null, - encodedJobId6 = null, - - jobIdGroup1 = null, - encodedJobIdGroup1 = null, - jobIdGroup2 = null, - encodedJobIdGroup2 = null, - jobIdGroup3 = null, - encodedJobIdGroup3 = null, - jobIdGroup4 = null, - encodedJobIdGroup4 = null, - jobIdGroup5 = null, - encodedJobIdGroup5 = null, - jobIdGroup6 = null, - encodedJobIdGroup6 = null, - - jobIdUser1 = null, - encodedJobIdUser1 = null, - jobIdUser2 = null, - encodedJobIdUser2 = null, - jobIdUser3 = null, - encodedJobIdUser3 = null, - jobIdUser4 = null, - encodedJobIdUser4 = null, - jobIdUser5 = null, - encodedJobIdUser5 = null, - jobIdUser6 = null, - encodedJobIdUser6 = null, - - jobIdUserSpec1 = null, - encodedJobIdUserSpec1 = null, - jobIdUserSpec2 = null, - encodedJobIdUserSpec2 = null, - jobIdUserSpec3 = null, - encodedJobIdUserSpec3 = null, - jobIdUserSpec4 = null, - encodedJobIdUserSpec4 = null, - jobIdUserSpec5 = null, - encodedJobIdUserSpec5 = null, - jobIdUserSpec6 = null, - encodedJobIdUserSpec6 = null, - jobIdUserSpec7 = null, - encodedJobIdUserSpec7 = null, - - jobIdGroupSpec1 = null, - encodedJobIdGroupSpec1 = null, - jobIdGroupSpec2 = null, - encodedJobIdGroupSpec2 = null, - jobIdGroupSpec3 = null, - encodedJobIdGroupSpec3 = null, - jobIdGroupSpec4 = null, - encodedJobIdGroupSpec4 = null, - jobIdGroupSpec5 = null, - encodedJobIdGroupSpec5 = null, - jobIdGroupSpec6 = null, - encodedJobIdGroupSpec6 = null, - jobIdGroupSpec7 = null, - encodedJobIdGroupSpec7 = null, - jobIdGroupSpec8 = null, - encodedJobIdGroupSpec8 = null, + + // for #all job permissions + allJob1 = null, + encodedAllJobOwnedByAdmin = null, + allJob2 = null, + encodedAllJobOwnedByUser1 = null, + allJob3 = null, + encodedAllJobOwnedByGroup1 = null, + allJob4 = null, + encodedAllJobOwnedByUser51 = null, + allJob5 = null, + encodedAllJobOwnedByGroup5 = null, + allJob6 = null, + encodedAllJobOwnedByAnonym = null, + + // for #dataset_owner job permissions + datasetOwnerJob1 = null, + encodedDatasetOwnerJobOwnedByAdmin = null, + datasetOwnerJob2 = null, + encodedDatasetOwnerJobOwnedByUser1 = null, + datasetOwnerJob3 = null, + encodedDatasetOwnerJobOwnedByGroup1 = null, + datasetOwnerJob4 = null, + encodedDatasetOwnerJobOwnedByUser51 = null, + datasetOwnerJob5 = null, + encodedDatasetOwnerJobOwnedByGroup5 = null, + datasetOwnerJob6 = null, + encodedDatasetOwnerJobOwnedByAnonym = null, + + // for #dataset_access job permissions + datasetAccessJob1 = null, + encodedDatasetAccessJobOwnedByAdmin = null, + datasetAccessJob2 = null, + encodedDatasetAccessJobOwnedByUser1 = null, + datasetAccessJob3 = null, + encodedDatasetAccessJobOwnedByGroup1 = null, + datasetAccessJob4 = null, + encodedDatasetAccessJobOwnedByUser51 = null, + datasetAccessJob5 = null, + encodedDatasetAccessJobOwnedByGroup5 = null, + datasetAccessJob6 = null, + encodedDatasetAccessJobOwnedByAnonym = null, + + // for user-based job permissions (USER5.1) + userSpecJob1 = null, + encodedUserSpecJobOwnedByAdmin = null, + userSpecJob2 = null, + encodedUserSpecJobOwnedByUser1 = null, + userSpecJob3 = null, + encodedUserSpecJobOwnedByGroup1 = null, + userSpecJob4 = null, + encodedUserSpecJobOwnedByUser51 = null, + userSpecJob5 = null, + encodedUserSpecJobOwnedByGroup5 = null, + userSpecJob6 = null, + encodedUserSpecJobOwnedByAnonym = null, + userSpecJob7 = null, + encodedUserSpecJobOwnedByUser52 = null, + + // for group-based job permissions (GROUP5) + groupSpecJob1 = null, + encodedGroupSpecJobOwnedByAdmin = null, + groupSpecJob2 = null, + encodedGroupSpecJobOwnedByUser1 = null, + groupSpecJob3 = null, + encodedGroupSpecJobOwnedByGroup1 = null, + groupSpecJob4 = null, + encodedGroupSpecJobOwnedByUser51 = null, + groupSpecJob5 = null, + encodedGroupSpecJobOwnedByGroup5 = null, + groupSpecJob6 = null, + encodedGroupSpecJobOwnedByAnonym = null, + groupSpecJob7 = null, + encodedGroupSpecJobOwnedByUser52 = null, + groupSpecJob8 = null, + encodedGroupSpecJobOwnedByUser3 = null, jobIdValidate1 = null, encodedJobIdValidate1 = null; @@ -244,7 +250,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0040: Add a new job as a user from ADMIN_GROUPS for himself/herself in '#all' configuration with no datasets in job parameters, which should fail", async () => { - const newDataset = { + const newJob = { ...jobAll, ownerUser: "admin", ownerGroup: "admin", @@ -255,7 +261,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.BadRequestStatusCode) @@ -267,7 +273,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0050: Add a new job as a user from ADMIN_GROUPS for himself/herself in '#all' configuration with not existing dataset IDs, which should fail", async () => { - const newDataset = { + const newJob = { ...jobAll, ownerUser: "admin", ownerGroup: "admin", @@ -281,7 +287,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.BadRequestStatusCode) @@ -293,7 +299,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0060: Add a new job as a user from ADMIN_GROUPS for himself/herself in '#datasetPublic' configuration with no jobParams parameter, which should fail", async () => { - const newDataset = { + const newJob = { type: "all_access", ownerUser: "admin", ownerGroup: "admin", @@ -301,7 +307,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.BadRequestStatusCode) @@ -312,7 +318,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0065: Add a new job as a user from ADMIN_GROUPS for himself/herself in '#datasetPublic' configuration with empty jobParams parameter", async () => { - const newDataset = { + const newJob = { type: "all_access", ownerUser: "admin", ownerGroup: "admin", @@ -321,7 +327,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -335,7 +341,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0070: Add a new job as a user from ADMIN_GROUPS for himself/herself in '#all' configuration", async () => { - const newDataset = { + const newJob = { ...jobAll, ownerUser: "admin", ownerGroup: "admin", @@ -348,7 +354,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -358,13 +364,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("admin"); res.body.should.have.property("ownerUser").and.be.equal("admin"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobId1 = res.body["id"]; - encodedJobId1 = encodeURIComponent(jobId1); + allJob1 = res.body["id"]; + encodedAllJobOwnedByAdmin = encodeURIComponent(allJob1); }); }); it("0080: Add a new job as a user from ADMIN_GROUPS for another user in '#all' configuration", async () => { - const newDataset = { + const newJob = { ...jobAll, ownerUser: "user1", ownerGroup: "group1", @@ -377,7 +383,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -387,13 +393,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("group1"); res.body.should.have.property("ownerUser").and.be.equal("user1"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobId2 = res.body["id"]; - encodedJobId2 = encodeURIComponent(jobId2); + allJob2 = res.body["id"]; + encodedAllJobOwnedByUser1 = encodeURIComponent(allJob2); }); }); it("0090: Add a new job as a user from ADMIN_GROUPS for undefined user from another group user in '#all' configuration", async () => { - const newDataset = { + const newJob = { ...jobAll, ownerGroup: "group1", jobParams: { @@ -405,7 +411,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -415,13 +421,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("group1"); res.body.should.not.have.property("ownerUser"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobId3 = res.body["id"]; - encodedJobId3 = encodeURIComponent(jobId3); + allJob3 = res.body["id"]; + encodedAllJobOwnedByGroup1 = encodeURIComponent(allJob3); }); }); it("0100: Add a new job as a user from ADMIN_GROUPS for anonymous user in '#all' configuration", async () => { - const newDataset = { + const newJob = { ...jobAll, jobParams: { datasetList: [ @@ -432,7 +438,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -442,13 +448,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.not.have.property("ownerGroup"); res.body.should.not.have.property("ownerUser"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobId6 = res.body["id"]; - encodedJobId6 = encodeURIComponent(jobId6); + allJob6 = res.body["id"]; + encodedAllJobOwnedByAnonym = encodeURIComponent(allJob6); }); }); it("0110: Add a new job as a user from CREATE_JOB_GROUPS for himself/herself in '#all' configuration", async () => { - const newDataset = { + const newJob = { ...jobAll, ownerUser: "user1", ownerGroup: "group1", @@ -461,7 +467,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser1}` }) .expect(TestData.EntryCreatedStatusCode) @@ -475,7 +481,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0120: Add a new job as a user from CREATE_JOB_GROUPS for his/her group in '#all' configuration", async () => { - const newDataset = { + const newJob = { ...jobAll, ownerGroup: "group1", jobParams: { @@ -487,7 +493,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser1}` }) .expect(TestData.EntryCreatedStatusCode) @@ -501,7 +507,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0130: Add a new job as a user from CREATE_JOB_GROUPS for another user in '#all' configuration, which should fail as bad request", async () => { - const newDataset = { + const newJob = { ...jobAll, ownerUser: "user5.1", ownerGroup: "group5", @@ -514,7 +520,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser1}` }) .expect(TestData.BadRequestStatusCode) @@ -526,7 +532,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0140: Add a new job as a user from CREATE_JOB_GROUPS for another group in '#all' configuration, which should fail as bad request", async () => { - const newDataset = { + const newJob = { ...jobAll, ownerGroup: "group5", jobParams: { @@ -538,7 +544,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser1}` }) .expect(TestData.BadRequestStatusCode) @@ -550,7 +556,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0150: Add a new job as a user from CREATE_JOB_GROUPS for anonymous user in '#all' configuration, which should fail as bad request", async () => { - const newDataset = { + const newJob = { ...jobAll, jobParams: { datasetList: [ @@ -561,7 +567,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser1}` }) .expect(TestData.BadRequestStatusCode) @@ -573,7 +579,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0160: Add a new job as a normal user for himself/herself in '#all' configuration", async () => { - const newDataset = { + const newJob = { ...jobAll, ownerUser: "user5.1", ownerGroup: "group5", @@ -586,7 +592,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.EntryCreatedStatusCode) @@ -596,13 +602,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("group5"); res.body.should.have.property("ownerUser").and.be.equal("user5.1"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobId4 = res.body["id"]; - encodedJobId4 = encodeURIComponent(jobId4); + allJob4 = res.body["id"]; + encodedAllJobOwnedByUser51 = encodeURIComponent(allJob4); }); }); it("0170: Add a new job as a normal user for his/her group in '#all' configuration", async () => { - const newDataset = { + const newJob = { ...jobAll, ownerGroup: "group5", jobParams: { @@ -614,7 +620,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.EntryCreatedStatusCode) @@ -624,13 +630,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("group5"); res.body.should.have.property("ownerUser").and.be.equal("user5.1"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobId5 = res.body["id"]; - encodedJobId5 = encodeURIComponent(jobId5); + allJob5 = res.body["id"]; + encodedAllJobOwnedByGroup5 = encodeURIComponent(allJob5); }); }); it("0180: Add a new job as a normal user for another user in '#all' configuration, which should fail as bad request", async () => { - const newDataset = { + const newJob = { ...jobAll, ownerUser: "user1", ownerGroup: "group1", @@ -643,7 +649,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.BadRequestStatusCode) @@ -655,7 +661,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0190: Add a new job as a normal user for another group in '#all' configuration, which should fail as bad request", async () => { - const newDataset = { + const newJob = { ...jobAll, ownerGroup: "group1", jobParams: { @@ -667,7 +673,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.BadRequestStatusCode) @@ -679,7 +685,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0200: Add a new job as a normal user for anonymous user in '#all' configuration, which should fail as bad request", async () => { - const newDataset = { + const newJob = { ...jobAll, jobParams: { datasetList: [ @@ -690,7 +696,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.BadRequestStatusCode) @@ -702,7 +708,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0210: Adds a new job as unauthenticated user in '#all' configuration", async () => { - const newDataset = { + const newJob = { ...jobAll, jobParams: { datasetList: [ @@ -713,7 +719,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .expect(TestData.EntryCreatedStatusCode) .expect("Content-Type", /json/) @@ -726,7 +732,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0220: Adds a new job as unauthenticated user for another user in '#all' configuration, which should fail as bad request", async () => { - const newDataset = { + const newJob = { ...jobAll, ownerGroup: "group1", jobParams: { @@ -738,7 +744,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .expect(TestData.BadRequestStatusCode) .expect("Content-Type", /json/) @@ -749,7 +755,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0230: Add a new job as a user from ADMIN_GROUPS for himself/herself in '#datasetPublic' configuration with all published datasets", async () => { - const newDataset = { + const newJob = { ...jobDatasetPublic, ownerUser: "admin", ownerGroup: "admin", @@ -762,7 +768,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -776,7 +782,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0240: Add a new job as a user from ADMIN_GROUPS for himself/herself in '#datasetPublic' configuration with one unpublished dataset", async () => { - const newDataset = { + const newJob = { ...jobDatasetPublic, ownerUser: "admin", ownerGroup: "admin", @@ -790,7 +796,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -804,7 +810,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0250: Add a new job as a user from ADMIN_GROUPS for another user in '#datasetPublic' configuration with one unpublished dataset", async () => { - const newDataset = { + const newJob = { ...jobDatasetPublic, ownerUser: "user1", ownerGroup: "group1", @@ -818,7 +824,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -832,7 +838,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0260: Add a new job as a user from ADMIN_GROUPS for another group in '#datasetPublic' configuration with one unpublished dataset", async () => { - const newDataset = { + const newJob = { ...jobDatasetPublic, ownerGroup: "group1", jobParams: { @@ -845,7 +851,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -859,7 +865,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0270: Add a new job as a user from ADMIN_GROUPS for anonymous user in '#datasetPublic' configuration with one unpublished dataset", async () => { - const newDataset = { + const newJob = { ...jobDatasetPublic, jobParams: { datasetList: [ @@ -871,7 +877,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -885,7 +891,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0280: Add a new job as a user from CREATE_JOB_GROUPS for himself/herself in '#datasetPublic' configuration with all published datasets", async () => { - const newDataset = { + const newJob = { ...jobDatasetPublic, ownerUser: "user1", ownerGroup: "group1", @@ -899,7 +905,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser1}` }) .expect(TestData.EntryCreatedStatusCode) @@ -913,7 +919,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0290: Add a new job as a user from CREATE_JOB_GROUPS for himself/herself in '#datasetPublic' configuration with one unpublished dataset", async () => { - const newDataset = { + const newJob = { ...jobDatasetPublic, ownerUser: "user1", ownerGroup: "group1", @@ -927,7 +933,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser1}` }) .expect(TestData.EntryCreatedStatusCode) @@ -941,7 +947,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0300: Add a new job as a normal user himself/herself in '#datasetPublic' configuration with a published dataset", async () => { - const newDataset = { + const newJob = { ...jobDatasetPublic, ownerUser: "user5.1", ownerGroup: "group5", @@ -954,7 +960,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.EntryCreatedStatusCode) @@ -968,7 +974,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0310: Add a new job as a normal user himself/herself in '#datasetPublic' configuration with unpublished datasets, which should fail as forbidden", async () => { - const newDataset = { + const newJob = { ...jobDatasetPublic, ownerUser: "user5.1", ownerGroup: "group5", @@ -983,7 +989,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.AccessForbiddenStatusCode) @@ -995,7 +1001,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0311: Add a new public job as a normal user himself/herself with a published dataset", async () => { - const newDataset = { + const newJob = { ...publicJob, ownerUser: "user5.1", ownerGroup: "group5", @@ -1008,7 +1014,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1022,7 +1028,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0312: Add a new public job as a normal user himself/herself with unpublished datasets, which should fail", async () => { - const newDataset = { + const newJob = { ...publicJob, ownerUser: "user5.1", ownerGroup: "group5", @@ -1037,7 +1043,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.ConflictStatusCode) @@ -1049,7 +1055,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0313: Add a new archive job as a normal user himself/herself with an archivable dataset", async () => { - const newDataset = { + const newJob = { ...archiveJob, ownerUser: "user5.1", ownerGroup: "group5", @@ -1062,7 +1068,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1073,7 +1079,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0314: Add a new retrieve job as a normal user himself/herself with a non retrievable dataset, which should fail", async () => { - const newDataset = { + const newJob = { ...retrieveJob, ownerUser: "user5.1", ownerGroup: "group5", @@ -1086,7 +1092,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.ConflictStatusCode) @@ -1098,7 +1104,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0315: Add a new public job as a normal user himself/herself with unknown files, which should fail", async () => { - const newDataset = { + const newJob = { ...publicJob, ownerUser: "user5.1", ownerGroup: "group5", @@ -1111,7 +1117,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.BadRequestStatusCode) @@ -1123,7 +1129,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0316: Add a new public job as a normal user himself/herself choosing only specific files", async () => { - const newDataset = { + const newJob = { ...publicJob, ownerUser: "user5.1", ownerGroup: "group5", @@ -1136,7 +1142,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1148,7 +1154,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0320: Add a new job as anonymous user in '#datasetPublic' configuration with all published datasets", async () => { - const newDataset = { + const newJob = { ...jobDatasetPublic, jobParams: { datasetList: [ @@ -1159,7 +1165,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .expect(TestData.EntryCreatedStatusCode) .expect("Content-Type", /json/) @@ -1172,7 +1178,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0330: Add a new job as anonymous user in '#datasetPublic' configuration with one unpublished dataset, which should fail as forbidden", async () => { - const newDataset = { + const newJob = { ...jobDatasetPublic, jobParams: { datasetList: [ @@ -1184,7 +1190,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .expect(TestData.AccessForbiddenStatusCode) .expect("Content-Type", /json/) @@ -1195,7 +1201,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0340: Add a new job as a user from ADMIN_GROUPS for himself/herself in '#authenticated' configuration", async () => { - const newDataset = { + const newJob = { ...jobAuthenticated, ownerUser: "admin", ownerGroup: "admin", @@ -1209,7 +1215,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1223,7 +1229,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0350: Add a new job as a user from ADMIN_GROUPS for another user in '#authenticated' configuration", async () => { - const newDataset = { + const newJob = { ...jobAuthenticated, ownerUser: "user1", ownerGroup: "group1", @@ -1237,7 +1243,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1250,7 +1256,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); }); it("0360: Add a new job as a user from ADMIN_GROUPS for another group in '#authenticated' configuration", async () => { - const newDataset = { + const newJob = { ...jobAuthenticated, ownerGroup: "group1", jobParams: { @@ -1263,7 +1269,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1277,7 +1283,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0370: Add a new job as a user from ADMIN_GROUPS for anonymous user in '#authenticated' configuration", async () => { - const newDataset = { + const newJob = { ...jobAuthenticated, jobParams: { datasetList: [ @@ -1289,7 +1295,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1303,7 +1309,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0380: Add a new job as a user from CREATE_JOB_GROUPS for himself/herself in '#authenticated' configuration", async () => { - const newDataset = { + const newJob = { ...jobAuthenticated, ownerUser: "user1", ownerGroup: "group1", @@ -1317,7 +1323,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser1}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1331,7 +1337,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0390: Add a new job as a normal user for himself/herself in '#authenticated' configuration", async () => { - const newDataset = { + const newJob = { ...jobAuthenticated, ownerUser: "user5.1", ownerGroup: "group5", @@ -1345,7 +1351,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1359,7 +1365,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0400: Add a new job as unauthenticated user in '#authenticated' configuration, which should fail as forbidden", async () => { - const newDataset = { + const newJob = { ...jobAuthenticated, jobParams: { datasetList: [ @@ -1371,7 +1377,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .expect(TestData.AccessForbiddenStatusCode) .expect("Content-Type", /json/) @@ -1382,7 +1388,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0410: Add a new job as a user from ADMIN_GROUPS for himself/herself in '#datasetAccess' configuration", async () => { - const newDataset = { + const newJob = { ...jobDatasetAccess, ownerUser: "admin", ownerGroup: "admin", @@ -1396,7 +1402,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1406,13 +1412,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("admin"); res.body.should.have.property("ownerUser").and.be.equal("admin"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdGroup1 = res.body["id"]; - encodedJobIdGroup1 = encodeURIComponent(jobIdGroup1); + datasetOwnerJob1 = res.body["id"]; + encodedDatasetOwnerJobOwnedByAdmin = encodeURIComponent(datasetOwnerJob1); }); }); it("0420: Add a new job as a user from ADMIN_GROUPS for another user in '#datasetAccess' configuration", async () => { - const newDataset = { + const newJob = { ...jobDatasetAccess, ownerUser: "user1", ownerGroup: "group1", @@ -1427,7 +1433,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1437,13 +1443,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("group1"); res.body.should.have.property("ownerUser").and.be.equal("user1"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdGroup2 = res.body["id"]; - encodedJobIdGroup2 = encodeURIComponent(jobIdGroup2); + datasetOwnerJob2 = res.body["id"]; + encodedDatasetOwnerJobOwnedByUser1 = encodeURIComponent(datasetOwnerJob2); }); }); it("0430: Add a new job as a user from ADMIN_GROUPS for another group in '#datasetAccess' configuration", async () => { - const newDataset = { + const newJob = { ...jobDatasetAccess, ownerGroup: "group1", jobParams: { @@ -1457,7 +1463,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1467,13 +1473,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("group1"); res.body.should.not.have.property("ownerUser"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdGroup3 = res.body["id"]; - encodedJobIdGroup3 = encodeURIComponent(jobIdGroup3); + datasetOwnerJob3 = res.body["id"]; + encodedDatasetOwnerJobOwnedByGroup1 = encodeURIComponent(datasetOwnerJob3); }); }); it("0435: Add a new job as a user from ADMIN_GROUPS for another group in '#datasetAccess' configuration", async () => { - const newDataset = { + const newJob = { ...jobDatasetAccess, ownerGroup: "group5", jobParams: { @@ -1487,7 +1493,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1497,13 +1503,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("group5"); res.body.should.not.have.property("ownerUser"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdGroup5 = res.body["id"]; - encodedJobIdGroup5 = encodeURIComponent(jobIdGroup5); + datasetOwnerJob5 = res.body["id"]; + encodedDatasetOwnerJobOwnedByGroup5 = encodeURIComponent(datasetOwnerJob5); }); }); it("0440: Add a new job as a user from ADMIN_GROUPS for anonymous user in '#datasetAccess' configuration", async () => { - const newDataset = { + const newJob = { ...jobDatasetAccess, jobParams: { datasetList: [ @@ -1515,7 +1521,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1525,13 +1531,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.not.have.property("ownerGroup"); res.body.should.not.have.property("ownerUser"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdGroup6 = res.body["id"]; - encodedJobIdGroup6 = encodeURIComponent(jobIdGroup6); + datasetOwnerJob6 = res.body["id"]; + encodedDatasetOwnerJobOwnedByAnonym = encodeURIComponent(datasetOwnerJob6); }); }); it("0450: Add a new job as a user from CREATE_JOB_GROUPS for himself/herself in '#datasetAccess' configuration with access to datasets", async () => { - const newDataset = { + const newJob = { ...jobDatasetAccess, ownerUser: "user1", ownerGroup: "group1", @@ -1545,7 +1551,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser1}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1559,7 +1565,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0460: Add a new job as a user from CREATE_JOB_GROUPS for himself/herself in '#datasetAccess' configuration with no access to datasets", async () => { - const newDataset = { + const newJob = { ...jobDatasetAccess, ownerUser: "user1", ownerGroup: "group1", @@ -1574,7 +1580,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser1}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1588,7 +1594,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0470: Adds a new job as user1 for user5.1 ownerUser and group5 ownerGroup for #datasetAccess, which should fail", async () => { - const newDataset = { + const newJob = { ...jobDatasetAccess, ownerUser: "user5.1", ownerGroup: "group5", @@ -1602,7 +1608,7 @@ describe("1100: Jobs: Test New Job Model", () => { }; return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser1}` }) .expect(TestData.BadRequestStatusCode) @@ -1614,7 +1620,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0480: Add a new job as a normal user for himself/herself in '#datasetAccess' configuration with access to datasets", async () => { - const newDataset = { + const newJob = { ...jobDatasetAccess, ownerUser: "user5.1", ownerGroup: "group5", @@ -1628,7 +1634,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1638,13 +1644,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("group5"); res.body.should.have.property("ownerUser").and.be.equal("user5.1"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdGroup4 = res.body["id"]; - encodedJobIdGroup4 = encodeURIComponent(jobIdGroup4); + datasetOwnerJob4 = res.body["id"]; + encodedDatasetOwnerJobOwnedByUser51 = encodeURIComponent(datasetOwnerJob4); }); }); it("0490: Add a new job as a normal user for himself/herself in '#datasetAccess' configuration with no access to datasets, which should fail as forbidden", async () => { - const newDataset = { + const newJob = { ...jobDatasetAccess, ownerUser: "user5.1", ownerGroup: "group5", @@ -1659,7 +1665,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.AccessForbiddenStatusCode) @@ -1671,7 +1677,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0500: Add a new job as a user from ADMIN_GROUPS for himself/herself in '#datasetOwner' configuration", async () => { - const newDataset = { + const newJob = { ...jobDatasetOwner, ownerUser: "admin", ownerGroup: "admin", @@ -1684,7 +1690,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1694,13 +1700,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("admin"); res.body.should.have.property("ownerUser").and.be.equal("admin"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdUser1 = res.body["id"]; - encodedJobIdUser1 = encodeURIComponent(jobIdUser1); + datasetAccessJob1 = res.body["id"]; + encodedDatasetAccessJobOwnedByAdmin = encodeURIComponent(datasetAccessJob1); }); }); it("0510: Add a new job as a user from ADMIN_GROUPS for himself/herself in '#datasetOwner' configuration", async () => { - const newDataset = { + const newJob = { ...jobDatasetOwner, ownerUser: "admin", ownerGroup: "admin", @@ -1715,7 +1721,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1729,7 +1735,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0520: Add a new job as a user from ADMIN_GROUPS for another user in '#datasetOwner' configuration", async () => { - const newDataset = { + const newJob = { ...jobDatasetOwner, ownerUser: "user1", ownerGroup: "group1", @@ -1744,7 +1750,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1754,13 +1760,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("group1"); res.body.should.have.property("ownerUser").and.be.equal("user1"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdUser2 = res.body["id"]; - encodedJobIdUser2 = encodeURIComponent(jobIdUser2); + datasetAccessJob2 = res.body["id"]; + encodedDatasetAccessJobOwnedByUser1 = encodeURIComponent(datasetAccessJob2); }); }); it("0530: Add a new job as a user from ADMIN_GROUPS for another group in '#datasetOwner' configuration", async () => { - const newDataset = { + const newJob = { ...jobDatasetOwner, ownerGroup: "group1", jobParams: { @@ -1774,7 +1780,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1784,13 +1790,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("group1"); res.body.should.not.have.property("ownerUser"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdUser3 = res.body["id"]; - encodedJobIdUser3 = encodeURIComponent(jobIdUser3); + datasetAccessJob3 = res.body["id"]; + encodedDatasetAccessJobOwnedByGroup1 = encodeURIComponent(datasetAccessJob3); }); }); it("0535: Add a new job as a user from ADMIN_GROUPS for another group in '#datasetOwner' configuration", async () => { - const newDataset = { + const newJob = { ...jobDatasetOwner, ownerGroup: "group5", jobParams: { @@ -1804,7 +1810,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1814,13 +1820,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("group5"); res.body.should.not.have.property("ownerUser"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdUser5 = res.body["id"]; - encodedJobIdUser5 = encodeURIComponent(jobIdUser5); + datasetAccessJob5 = res.body["id"]; + encodedDatasetAccessJobOwnedByGroup5 = encodeURIComponent(datasetAccessJob5); }); }); it("0540: Add a new job as a user from ADMIN_GROUPS for anonymous user in '#datasetOwner' configuration", async () => { - const newDataset = { + const newJob = { ...jobDatasetOwner, jobParams: { datasetList: [ @@ -1833,7 +1839,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1843,13 +1849,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.not.have.property("ownerGroup"); res.body.should.not.have.property("ownerUser"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdUser6 = res.body["id"]; - encodedJobIdUser6 = encodeURIComponent(jobIdUser6); + datasetAccessJob6 = res.body["id"]; + encodedDatasetAccessJobOwnedByAnonym = encodeURIComponent(datasetAccessJob6); }); }); it("0550: Add a new job as a user from CREATE_JOB_GROUPS for himself/herself in '#datasetOwner' configuration with datasets owned by his/her group", async () => { - const newDataset = { + const newJob = { ...jobDatasetOwner, ownerUser: "user1", ownerGroup: "group1", @@ -1862,7 +1868,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser1}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1876,7 +1882,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0560: Add a new job as a user from CREATE_JOB_GROUPS for himself/herself in '#datasetOwner' configuration with datasets owned by his/her group", async () => { - const newDataset = { + const newJob = { ...jobDatasetOwner, ownerUser: "user1", ownerGroup: "group1", @@ -1890,7 +1896,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser1}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1904,7 +1910,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0570: Add a new job as a normal user for himself/herself in '#datasetOwner' configuration with datasets owned by his/her group", async () => { - const newDataset = { + const newJob = { ...jobDatasetOwner, ownerUser: "user5.1", ownerGroup: "group5", @@ -1917,7 +1923,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1927,13 +1933,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("group5"); res.body.should.have.property("ownerUser").and.be.equal("user5.1"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdUser4 = res.body["id"]; - encodedJobIdUser4 = encodeURIComponent(jobIdUser4); + datasetAccessJob4 = res.body["id"]; + encodedDatasetAccessJobOwnedByUser51 = encodeURIComponent(datasetAccessJob4); }); }); it("0580: Add a new job as a normal user for himself/herself in '#datasetOwner' configuration with datasets not owned by his/her group, which should fail as forbidden", async () => { - const newDataset = { + const newJob = { ...jobDatasetOwner, ownerUser: "user5.1", ownerGroup: "group5", @@ -1946,7 +1952,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.AccessForbiddenStatusCode) @@ -1958,7 +1964,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0590: Add a new job as a user from ADMIN_GROUPS for himself/herself in '#USER5.1' configuration", async () => { - const newDataset = { + const newJob = { ...jobUser51, ownerUser: "admin", ownerGroup: "admin", @@ -1972,7 +1978,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -1982,13 +1988,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("admin"); res.body.should.have.property("ownerUser").and.be.equal("admin"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdUserSpec1 = res.body["id"]; - encodedJobIdUserSpec1 = encodeURIComponent(jobIdUserSpec1); + userSpecJob1 = res.body["id"]; + encodedUserSpecJobOwnedByAdmin = encodeURIComponent(userSpecJob1); }); }); it("0600: Add a new job as a user from ADMIN_GROUPS for another user in '#USER5.1' configuration", async () => { - const newDataset = { + const newJob = { ...jobUser51, ownerUser: "user1", ownerGroup: "group1", @@ -2002,7 +2008,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -2012,13 +2018,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("group1"); res.body.should.have.property("ownerUser").and.be.equal("user1"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdUserSpec2 = res.body["id"]; - encodedJobIdUserSpec2 = encodeURIComponent(jobIdUserSpec2); + userSpecJob2 = res.body["id"]; + encodedUserSpecJobOwnedByUser1 = encodeURIComponent(userSpecJob2); }); }); it("0610: Add a new job as a user from ADMIN_GROUPS for another group in '#USER5.1' configuration", async () => { - const newDataset = { + const newJob = { ...jobUser51, ownerGroup: "group1", jobParams: { @@ -2031,7 +2037,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -2041,13 +2047,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("group1"); res.body.should.not.have.property("ownerUser"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdUserSpec3 = res.body["id"]; - encodedJobIdUserSpec3 = encodeURIComponent(jobIdUserSpec3); + userSpecJob3 = res.body["id"]; + encodedUserSpecJobOwnedByGroup1 = encodeURIComponent(userSpecJob3); }); }); it("0615: Add a new job as a user from ADMIN_GROUPS for another group in '#USER5.1' configuration", async () => { - const newDataset = { + const newJob = { ...jobUser51, ownerGroup: "group5", jobParams: { @@ -2060,7 +2066,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -2070,13 +2076,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("group5"); res.body.should.not.have.property("ownerUser"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdUserSpec5 = res.body["id"]; - encodedJobIdUserSpec5 = encodeURIComponent(jobIdUserSpec5); + userSpecJob5 = res.body["id"]; + encodedUserSpecJobOwnedByGroup5 = encodeURIComponent(userSpecJob5); }); }); it("0616: Add a new job as a user from ADMIN_GROUPS for another user in '#USER5.1' configuration", async () => { - const newDataset = { + const newJob = { ...jobUser51, ownerUser: "user5.2", ownerGroup: "group5", @@ -2090,7 +2096,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -2100,14 +2106,14 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("group5"); res.body.should.have.property("ownerUser").and.be.equal("user5.2"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdUserSpec7 = res.body["id"]; - encodedJobIdUserSpec7 = encodeURIComponent(jobIdUserSpec7); + userSpecJob7 = res.body["id"]; + encodedUserSpecJobOwnedByUser52 = encodeURIComponent(userSpecJob7); }); }); it("0620: Add a new job as a user from ADMIN_GROUPS for anonymous user in '#USER5.1' configuration", async () => { - const newDataset = { + const newJob = { ...jobUser51, jobParams: { datasetList: [ @@ -2119,7 +2125,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -2129,13 +2135,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.not.have.property("ownerGroup"); res.body.should.not.have.property("ownerUser"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdUserSpec6 = res.body["id"]; - encodedJobIdUserSpec6 = encodeURIComponent(jobIdUserSpec6); + userSpecJob6 = res.body["id"]; + encodedUserSpecJobOwnedByAnonym = encodeURIComponent(userSpecJob6); }); }); it("0630: Add a new job as a user from CREATE_JOB_GROUPS for himself/herself user in '#USER5.1' configuration", async () => { - const newDataset = { + const newJob = { ...jobUser51, ownerUser: "user1", ownerGroup: "group1", @@ -2149,7 +2155,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser1}` }) .expect(TestData.EntryCreatedStatusCode) @@ -2163,7 +2169,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0640: Add a new job as a user from CREATE_JOB_GROUPS for user5.1 in '#USER5.1' configuration, which should fail as bad request", async () => { - const newDataset = { + const newJob = { ...jobUser51, ownerUser: "user5.1", ownerGroup: "group5", @@ -2177,7 +2183,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser1}` }) .expect(TestData.BadRequestStatusCode) @@ -2189,7 +2195,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0650: Adds a new job as user5.1 himself/herself in '#USER5.1' configuration", async () => { - const newDataset = { + const newJob = { ...jobUser51, ownerUser: "user5.1", ownerGroup: "group5", @@ -2203,7 +2209,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.EntryCreatedStatusCode) @@ -2213,13 +2219,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("group5"); res.body.should.have.property("ownerUser").and.be.equal("user5.1"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdUserSpec4 = res.body["id"]; - encodedJobIdUserSpec4 = encodeURIComponent(jobIdUserSpec4); + userSpecJob4 = res.body["id"]; + encodedUserSpecJobOwnedByUser51 = encodeURIComponent(userSpecJob4); }); }); it("0660: Adds a new job as user5.1 for no ownerUser and group5 ownerGroup in #USER5.1 configuration", async () => { - const newDataset = { + const newJob = { ...jobUser51, ownerGroup: "group5", jobParams: { @@ -2232,7 +2238,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.EntryCreatedStatusCode) @@ -2246,7 +2252,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0670: Adds a new job as user5.2 for himself/herself in #USER5.1, which should fail as forbidden", async () => { - const newDataset = { + const newJob = { ...jobUser51, ownerUser: "user5.2", ownerGroup: "group5", @@ -2260,7 +2266,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser52}` }) .expect(TestData.AccessForbiddenStatusCode) @@ -2272,7 +2278,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0680: Add a new job as a user from ADMIN_GROUPS for himself/herself in '#@group5' configuration", async () => { - const newDataset = { + const newJob = { ...jobGroup5, ownerUser: "admin", ownerGroup: "admin", @@ -2286,7 +2292,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -2296,13 +2302,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("admin"); res.body.should.have.property("ownerUser").and.be.equal("admin"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdGroupSpec1 = res.body["id"]; - encodedJobIdGroupSpec1 = encodeURIComponent(jobIdGroupSpec1); + groupSpecJob1 = res.body["id"]; + encodedGroupSpecJobOwnedByAdmin = encodeURIComponent(groupSpecJob1); }); }); it("0690: Add a new job as a user from ADMIN_GROUPS for another user in '#@group5' configuration", async () => { - const newDataset = { + const newJob = { ...jobGroup5, ownerUser: "user1", ownerGroup: "group1", @@ -2316,7 +2322,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -2326,13 +2332,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("group1"); res.body.should.have.property("ownerUser").and.be.equal("user1"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdGroupSpec2 = res.body["id"]; - encodedJobIdGroupSpec2 = encodeURIComponent(jobIdGroupSpec2); + groupSpecJob2 = res.body["id"]; + encodedGroupSpecJobOwnedByUser1 = encodeURIComponent(groupSpecJob2); }); }); it("0700: Add a new job as a user from ADMIN_GROUPS for another group in '#@group5' configuration", async () => { - const newDataset = { + const newJob = { ...jobGroup5, ownerGroup: "group1", jobParams: { @@ -2345,7 +2351,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -2355,13 +2361,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("group1"); res.body.should.not.have.property("ownerUser"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdGroupSpec3 = res.body["id"]; - encodedJobIdGroupSpec3 = encodeURIComponent(jobIdGroupSpec3); + groupSpecJob3 = res.body["id"]; + encodedGroupSpecJobOwnedByGroup1 = encodeURIComponent(groupSpecJob3); }); }); it("0705: Add a new job as a user from ADMIN_GROUPS for another group in '#@group5' configuration", async () => { - const newDataset = { + const newJob = { ...jobGroup5, ownerGroup: "group5", jobParams: { @@ -2374,7 +2380,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -2384,13 +2390,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("group5"); res.body.should.not.have.property("ownerUser"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdGroupSpec5 = res.body["id"]; - encodedJobIdGroupSpec5 = encodeURIComponent(jobIdGroupSpec5); + groupSpecJob5 = res.body["id"]; + encodedGroupSpecJobOwnedByGroup5 = encodeURIComponent(groupSpecJob5); }); }); it("0706: Add a new job as a user from ADMIN_GROUPS for another user in '@group5' configuration", async () => { - const newDataset = { + const newJob = { ...jobGroup5, ownerUser: "user3", ownerGroup: "group3", @@ -2404,7 +2410,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -2414,13 +2420,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("group3"); res.body.should.have.property("ownerUser").and.be.equal("user3"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdGroupSpec8 = res.body["id"]; - encodedJobIdGroupSpec8 = encodeURIComponent(jobIdGroupSpec8); + groupSpecJob8 = res.body["id"]; + encodedGroupSpecJobOwnedByUser3 = encodeURIComponent(groupSpecJob8); }); }); it("0710: Add a new job as a user from ADMIN_GROUPS for anonymous user in '#@group5' configuration", async () => { - const newDataset = { + const newJob = { ...jobGroup5, jobParams: { datasetList: [ @@ -2432,7 +2438,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -2442,13 +2448,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.not.have.property("ownerGroup"); res.body.should.not.have.property("ownerUser"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdGroupSpec6 = res.body["id"]; - encodedJobIdGroupSpec6 = encodeURIComponent(jobIdGroupSpec6); + groupSpecJob6 = res.body["id"]; + encodedGroupSpecJobOwnedByAnonym = encodeURIComponent(groupSpecJob6); }); }); it("0720: Add a new job as a user from CREATE_JOB_GROUPS for another group in '#@group5' configuration", async () => { - const newDataset = { + const newJob = { ...jobGroup5, ownerUser: "user1", ownerGroup: "group1", @@ -2462,7 +2468,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser1}` }) .expect(TestData.EntryCreatedStatusCode) @@ -2476,7 +2482,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0730: Add a new job as a user from CREATE_JOB_GROUPS for user 5.1 in '#@group5' configuration, which should fail as bad request", async () => { - const newDataset = { + const newJob = { ...jobGroup5, ownerUser: "user5.1", ownerGroup: "group5", @@ -2490,7 +2496,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser1}` }) .expect(TestData.BadRequestStatusCode) @@ -2502,7 +2508,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0740: Add a new job as a user 5.1 for himself/herself in '#@group5' configuration", async () => { - const newDataset = { + const newJob = { ...jobGroup5, ownerUser: "user5.1", ownerGroup: "group5", @@ -2516,7 +2522,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.EntryCreatedStatusCode) @@ -2526,13 +2532,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("group5"); res.body.should.have.property("ownerUser").and.be.equal("user5.1"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdGroupSpec4 = res.body["id"]; - encodedJobIdGroupSpec4 = encodeURIComponent(jobIdGroupSpec4); + groupSpecJob4 = res.body["id"]; + encodedGroupSpecJobOwnedByUser51 = encodeURIComponent(groupSpecJob4); }); }); it("0750: Add a new job as a user 5.1 for another user in his/her group in '#@group5' configuration", async () => { - const newDataset = { + const newJob = { ...jobGroup5, ownerGroup: "group5", jobParams: { @@ -2545,7 +2551,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.EntryCreatedStatusCode) @@ -2559,7 +2565,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0760: Add a new job as a user 5.2 for himself/herself in '#@group5' configuration", async () => { - const newDataset = { + const newJob = { ...jobGroup5, ownerUser: "user5.2", ownerGroup: "group5", @@ -2573,7 +2579,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser52}` }) .expect(TestData.EntryCreatedStatusCode) @@ -2583,13 +2589,13 @@ describe("1100: Jobs: Test New Job Model", () => { res.body.should.have.property("ownerGroup").and.be.equal("group5"); res.body.should.have.property("ownerUser").and.be.equal("user5.2"); res.body.should.have.property("statusCode").to.be.equal("jobCreated"); - jobIdGroupSpec7 = res.body["id"]; - encodedJobIdGroupSpec7 = encodeURIComponent(jobIdGroupSpec7); + groupSpecJob7 = res.body["id"]; + encodedGroupSpecJobOwnedByUser52 = encodeURIComponent(groupSpecJob7); }); }); it("0770: Adds a new job as user3 for himself/herself in #@group5 configuration, which should fail as forbidden", async () => { - const newDataset = { + const newJob = { ...jobGroup5, ownerUser: "user3", ownerGroup: "group3", @@ -2603,7 +2609,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser3}` }) .expect(TestData.AccessForbiddenStatusCode) @@ -2616,7 +2622,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("0780: Adds a status update to a job as a user from ADMIN_GROUPS for his/her job in '#all' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobId1}`) + .patch(`/api/v3/Jobs/${encodedAllJobOwnedByAdmin}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2629,7 +2635,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("0790: Adds a Status update to a job as a user from ADMIN_GROUPS for another user's job in '#all' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobId2}`) + .patch(`/api/v3/Jobs/${encodedAllJobOwnedByUser1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2642,7 +2648,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("0800: Adds a Status update to a job as a user from ADMIN_GROUPS for another group's job in '#all' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobId3}`) + .patch(`/api/v3/Jobs/${encodedAllJobOwnedByGroup1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2655,7 +2661,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("0810: Adds a Status update to a job as a user from ADMIN_GROUPS for anonymous user's job in '#all' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobId6}`) + .patch(`/api/v3/Jobs/${encodedAllJobOwnedByAnonym}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2668,7 +2674,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("0820: Adds a Status update to a job as a user from UPDATE_JOB_GROUPS for his/her job in '#all' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobId2}`) + .patch(`/api/v3/Jobs/${encodedAllJobOwnedByUser1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2681,7 +2687,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("0830: Adds a Status update to a job as a user from UPDATE_JOB_GROUPS for another user's job in '#all' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobId4}`) + .patch(`/api/v3/Jobs/${encodedAllJobOwnedByUser51}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2694,7 +2700,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("0840: Adds a Status update to a job as a user from UPDATE_JOB_GROUPS for his/her group in '#all' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobId3}`) + .patch(`/api/v3/Jobs/${encodedAllJobOwnedByGroup1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2707,7 +2713,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("0850: Adds a Status update to a job as a user from UPDATE_JOB_GROUPS for another user's group in '#all' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobId5}`) + .patch(`/api/v3/Jobs/${encodedAllJobOwnedByGroup5}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2720,7 +2726,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("0860: Adds a Status update to a job as a user from UPDATE_JOB_GROUPS for anonymous user's group in '#all' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobId6}`) + .patch(`/api/v3/Jobs/${encodedAllJobOwnedByAnonym}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2733,7 +2739,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("0870: Adds a Status update to a job as a normal user for his/her job in '#all' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobId4}`) + .patch(`/api/v3/Jobs/${encodedAllJobOwnedByUser51}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2746,7 +2752,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("0880: Adds a Status update to a job as a normal user for another user's job in '#all' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobId2}`) + .patch(`/api/v3/Jobs/${encodedAllJobOwnedByUser1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2759,7 +2765,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("0890: Adds a Status update to a job as a normal user for his/her group in '#all' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobId5}`) + .patch(`/api/v3/Jobs/${encodedAllJobOwnedByGroup5}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2772,7 +2778,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("0900: Adds a Status update to a job as a normal user for another user's group in '#all' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobId3}`) + .patch(`/api/v3/Jobs/${encodedAllJobOwnedByGroup1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2785,7 +2791,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("0910: Adds a Status update to a job as a normal user for anonymous user's group in '#all' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobId6}`) + .patch(`/api/v3/Jobs/${encodedAllJobOwnedByAnonym}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2798,7 +2804,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("0920: Adds a Status update to a job as unauthhenticated user for anonymous job in '#all' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobId6}`) + .patch(`/api/v3/Jobs/${encodedAllJobOwnedByAnonym}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2810,7 +2816,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("0930: Adds a Status update to a job as unauthhenticated user for anouther group's job in '#all' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobId3}`) + .patch(`/api/v3/Jobs/${encodedAllJobOwnedByGroup1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2822,7 +2828,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("0940: Adds a Status update to a job as unauthhenticated user for another user's job in '#all' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobId2}`) + .patch(`/api/v3/Jobs/${encodedAllJobOwnedByUser1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2834,7 +2840,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("0950: Adds a status update to a job as a user from ADMIN_GROUPS for his/her job in '#jobOwnerUser' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUser1}`) + .patch(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByAdmin}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2847,7 +2853,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("0960: Adds a Status update to a job as a user from ADMIN_GROUPS for another group's job in '#jobOwnerUser' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUser2}`) + .patch(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByUser1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2860,7 +2866,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("0970: Adds a Status update to a job as a user from ADMIN_GROUPS for anonymous user's job in '#jobOwnerUser' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUser3}`) + .patch(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByGroup1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2873,7 +2879,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("0980: Adds a Status update to a job as a user from ADMIN_GROUPS for anonymous user's job in '#jobOwnerUser' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUser6}`) + .patch(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByAnonym}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2886,7 +2892,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("0990: Adds a Status update to a job as a user from UPDATE_JOB_GROUPS for his/her job in '#jobOwnerUser' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUser2}`) + .patch(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByUser1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2899,7 +2905,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1000: Adds a Status update to a job as a user from UPDATE_JOB_GROUPS for another user's job in '#jobOwnerUser' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUser4}`) + .patch(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByUser51}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2912,7 +2918,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1010: Adds a Status update to a job as a user from UPDATE_JOB_GROUPS for his/her group in '#jobOwnerUser' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUser3}`) + .patch(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByGroup1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2925,7 +2931,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1020: Adds a Status update to a job as a user from UPDATE_JOB_GROUPS for another user's group in '#jobOwnerUser' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUser5}`) + .patch(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByGroup5}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2938,7 +2944,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1030: Adds a Status update to a job as a user from UPDATE_JOB_GROUPS for anonymous user's group in '#jobOwnerUser' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUser6}`) + .patch(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByAnonym}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2951,7 +2957,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1040: Adds a Status update to a job as a normal user for his/her job in '#jobOwnerUser' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUser4}`) + .patch(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByUser51}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2964,7 +2970,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1050: Adds a Status update to a job as a normal user for another user's job in '#jobOwnerUser' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUser2}`) + .patch(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByUser1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2977,7 +2983,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1060: Adds a Status update to a job as a normal user for his/her group in '#jobOwnerUser' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUser5}`) + .patch(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByGroup5}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -2990,7 +2996,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1070: Adds a Status update to a job as a normal user for another user's group in '#jobOwnerUser' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUser3}`) + .patch(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByGroup1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3003,7 +3009,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1080: Adds a Status update to a job as a normal user for anonymous user's group in '#jobOwnerUser' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUser6}`) + .patch(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByAnonym}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3016,7 +3022,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1090: Adds a Status update to a job as unauthhenticated user for anonymous user's group in '#jobOwnerUser' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUser6}`) + .patch(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByAnonym}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3028,7 +3034,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1100: Adds a status update to a job as a user from ADMIN_GROUPS for his/her job in '#jobOwnerGroup' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroup1}`) + .patch(`/api/v3/Jobs/${encodedDatasetOwnerJobOwnedByAdmin}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3041,7 +3047,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1110: Adds a Status update to a job as a user from ADMIN_GROUPS for another group's job in '#jobOwnerGroup' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroup2}`) + .patch(`/api/v3/Jobs/${encodedDatasetOwnerJobOwnedByUser1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3054,7 +3060,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1120: Adds a Status update to a job as a user from ADMIN_GROUPS for anonymous user's job in '#jobOwnerGroup' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroup3}`) + .patch(`/api/v3/Jobs/${encodedDatasetOwnerJobOwnedByGroup1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3067,7 +3073,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1130: Adds a Status update to a job as a user from ADMIN_GROUPS for anonymous user's job in '#jobOwnerGroup' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroup6}`) + .patch(`/api/v3/Jobs/${encodedDatasetOwnerJobOwnedByAnonym}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3081,7 +3087,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1140: Adds a Status update to a job as a user from UPDATE_JOB_GROUPS for his/her job in '#jobOwnerGroup' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroup2}`) + .patch(`/api/v3/Jobs/${encodedDatasetOwnerJobOwnedByUser1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3093,7 +3099,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("1150: Adds a Status update to a job as a user from UPDATE_JOB_GROUPS for another user's job in '#jobOwnerGroup' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroup4}`) + .patch(`/api/v3/Jobs/${encodedDatasetOwnerJobOwnedByUser51}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3105,7 +3111,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("1160: Adds a Status update to a job as a user from UPDATE_JOB_GROUPS for his/her group in '#jobOwnerGroup' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroup3}`) + .patch(`/api/v3/Jobs/${encodedDatasetOwnerJobOwnedByGroup1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3117,7 +3123,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("1170: Adds a Status update to a job as a user from UPDATE_JOB_GROUPS for another user's group in '#jobOwnerGroup' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroup5}`) + .patch(`/api/v3/Jobs/${encodedDatasetOwnerJobOwnedByGroup5}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3130,7 +3136,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1180: Adds a Status update to a job as a user from UPDATE_JOB_GROUPS for anonymous user's group in '#jobOwnerGroup' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroup6}`) + .patch(`/api/v3/Jobs/${encodedDatasetOwnerJobOwnedByAnonym}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3143,7 +3149,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1190: Adds a Status update to a job as a normal user for his/her job in '#jobOwnerGroup' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroup4}`) + .patch(`/api/v3/Jobs/${encodedDatasetOwnerJobOwnedByUser51}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3156,7 +3162,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1200: Adds a Status update to a job as a normal user for another user's job in '#jobOwnerGroup' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroup2}`) + .patch(`/api/v3/Jobs/${encodedDatasetOwnerJobOwnedByUser1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3169,7 +3175,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1210: Adds a Status update to a job as a normal user for his/her group in '#jobOwnerGroup' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroup5}`) + .patch(`/api/v3/Jobs/${encodedDatasetOwnerJobOwnedByGroup5}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3182,7 +3188,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1220: Adds a Status update to a job as a normal user for another user's group in '#jobOwnerGroup' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroup3}`) + .patch(`/api/v3/Jobs/${encodedDatasetOwnerJobOwnedByGroup1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3195,7 +3201,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1230: Adds a Status update to a job as a normal user for anonymous user's group in '#jobOwnerGroup' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroup6}`) + .patch(`/api/v3/Jobs/${encodedDatasetOwnerJobOwnedByAnonym}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3208,7 +3214,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1240: Adds a Status update to a job as unauthhenticated user for anonymous user's group in '#jobOwnerGroup' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroup6}`) + .patch(`/api/v3/Jobs/${encodedDatasetOwnerJobOwnedByAnonym}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3220,7 +3226,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1250: Adds a Status update to a job as a user from ADMIN_GROUPS for his/her job in 'USER5.1' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUserSpec1}`) + .patch(`/api/v3/Jobs/${encodedUserSpecJobOwnedByAdmin}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3233,7 +3239,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1260: Adds a Status update to a job as a user from ADMIN_GROUPS for another group's job in 'USER5.1' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUserSpec2}`) + .patch(`/api/v3/Jobs/${encodedUserSpecJobOwnedByUser1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3246,7 +3252,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1270: Adds a Status update to a job as a user from ADMIN_GROUPS for anonymous user's job in 'USER5.1' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUserSpec3}`) + .patch(`/api/v3/Jobs/${encodedUserSpecJobOwnedByGroup1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3259,7 +3265,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1280: Adds a Status update to a job as a user from ADMIN_GROUPS for anonymous user's job in 'USER5.1' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUserSpec6}`) + .patch(`/api/v3/Jobs/${encodedUserSpecJobOwnedByAnonym}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3272,7 +3278,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1290: Adds a Status update to a job as a user from UPDATE_JOB_GROUPS for his/her job in 'USER5.1' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUserSpec2}`) + .patch(`/api/v3/Jobs/${encodedUserSpecJobOwnedByUser1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3285,7 +3291,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1300: Adds a Status update to a job as a user from UPDATE_JOB_GROUPS for another user's job in 'USER5.1' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUserSpec4}`) + .patch(`/api/v3/Jobs/${encodedUserSpecJobOwnedByUser51}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3298,7 +3304,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1310: Adds a Status update to a job as a user from UPDATE_JOB_GROUPS for his/her group in 'USER5.1' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUserSpec3}`) + .patch(`/api/v3/Jobs/${encodedUserSpecJobOwnedByGroup1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3311,7 +3317,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1320: Adds a Status update to a job as a user from UPDATE_JOB_GROUPS for another user's group in 'USER5.1' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUserSpec5}`) + .patch(`/api/v3/Jobs/${encodedUserSpecJobOwnedByGroup5}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3324,7 +3330,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1330: Adds a Status update to a job as a user from UPDATE_JOB_GROUPS for anonymous user's group in 'USER5.1' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUserSpec6}`) + .patch(`/api/v3/Jobs/${encodedUserSpecJobOwnedByAnonym}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3337,7 +3343,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1340: Adds a Status update to a job as user5.1 for his/her job in 'USER5.1' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUserSpec4}`) + .patch(`/api/v3/Jobs/${encodedUserSpecJobOwnedByUser51}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3350,7 +3356,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1350: Adds a Status update to a job as user5.1 for another user's job in 'USER5.1' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUserSpec2}`) + .patch(`/api/v3/Jobs/${encodedUserSpecJobOwnedByUser1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3363,7 +3369,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1360: Adds a Status update to a job as user5.1 for his/her group in 'USER5.1' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUserSpec5}`) + .patch(`/api/v3/Jobs/${encodedUserSpecJobOwnedByGroup5}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3376,7 +3382,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1370: Adds a Status update to a job as user5.1 for another user's group in 'USER5.1' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUserSpec4}`) + .patch(`/api/v3/Jobs/${encodedUserSpecJobOwnedByUser51}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3389,7 +3395,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1380: Adds a Status update to a job as user5.1 for anonymous user's group in 'USER5.1' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUserSpec6}`) + .patch(`/api/v3/Jobs/${encodedUserSpecJobOwnedByAnonym}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3402,7 +3408,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1390: Adds a Status update to a job as user5.2 for his/her job in 'USER5.1' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUserSpec7}`) + .patch(`/api/v3/Jobs/${encodedUserSpecJobOwnedByUser52}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3415,7 +3421,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1400: Adds a Status update to a job as user5.2 for user's 5.1 in same group job in 'USER5.1' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUserSpec4}`) + .patch(`/api/v3/Jobs/${encodedUserSpecJobOwnedByUser51}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3428,7 +3434,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1410: Adds a Status update to a job as user5.2 for another user in his/her group job in 'USER5.1' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdUserSpec5}`) + .patch(`/api/v3/Jobs/${encodedUserSpecJobOwnedByGroup5}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3441,7 +3447,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1420: Adds a status update to a job as a user from ADMIN_GROUPS for his/her job in '@group5' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroupSpec1}`) + .patch(`/api/v3/Jobs/${encodedGroupSpecJobOwnedByAdmin}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3454,7 +3460,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1430: Adds a Status update to a job as a user from ADMIN_GROUPS for another group's job in '@group5' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroupSpec2}`) + .patch(`/api/v3/Jobs/${encodedGroupSpecJobOwnedByUser1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3467,7 +3473,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1440: Adds a Status update to a job as a user from ADMIN_GROUPS for anonymous user's job in '@group5' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroupSpec3}`) + .patch(`/api/v3/Jobs/${encodedGroupSpecJobOwnedByGroup1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3480,7 +3486,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1450: Adds a Status update to a job as a user from ADMIN_GROUPS for anonymous user's job in '@group5' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroupSpec6}`) + .patch(`/api/v3/Jobs/${encodedGroupSpecJobOwnedByAnonym}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3493,7 +3499,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1460: Adds a Status update to a job as a user from UPDATE_JOB_GROUPS for his/her job in '@group5' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroupSpec2}`) + .patch(`/api/v3/Jobs/${encodedGroupSpecJobOwnedByUser1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3506,7 +3512,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1470: Adds a Status update to a job as a user from UPDATE_JOB_GROUPS for another user's job in '@group5' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroupSpec4}`) + .patch(`/api/v3/Jobs/${encodedGroupSpecJobOwnedByUser51}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3519,7 +3525,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1480: Adds a Status update to a job as a user from UPDATE_JOB_GROUPS for his/her group in '@group5' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroupSpec3}`) + .patch(`/api/v3/Jobs/${encodedGroupSpecJobOwnedByGroup1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3532,7 +3538,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1490: Adds a Status update to a job as a user from UPDATE_JOB_GROUPS for another user's group in '@group5' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroupSpec5}`) + .patch(`/api/v3/Jobs/${encodedGroupSpecJobOwnedByGroup5}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3545,7 +3551,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1500: Adds a Status update to a job as a user from UPDATE_JOB_GROUPS for anonymous user's group in '@group5' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroupSpec6}`) + .patch(`/api/v3/Jobs/${encodedGroupSpecJobOwnedByAnonym}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3558,7 +3564,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1510: Adds a Status update to a job as user5.1 for his/her job in '@group5' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroupSpec4}`) + .patch(`/api/v3/Jobs/${encodedGroupSpecJobOwnedByUser51}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3571,7 +3577,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1520: Adds a Status update to a job as user5.1 for another user's job in '@group5' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroupSpec2}`) + .patch(`/api/v3/Jobs/${encodedGroupSpecJobOwnedByUser1}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3584,7 +3590,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1530: Adds a Status update to a job as user5.1 for his/her group in '@group5' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroupSpec5}`) + .patch(`/api/v3/Jobs/${encodedGroupSpecJobOwnedByGroup5}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3597,7 +3603,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1540: Adds a Status update to a job as user5.1 for another user's group in '@group5' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroupSpec4}`) + .patch(`/api/v3/Jobs/${encodedGroupSpecJobOwnedByUser51}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3610,7 +3616,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1550: Adds a Status update to a job as user5.1 for anonymous user's group in '@group5' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroupSpec6}`) + .patch(`/api/v3/Jobs/${encodedGroupSpecJobOwnedByAnonym}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3623,7 +3629,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1560: Adds a Status update to a job as user5.2 for his/her job in '@group5' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroupSpec7}`) + .patch(`/api/v3/Jobs/${encodedGroupSpecJobOwnedByUser52}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3637,7 +3643,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1570: Adds a Status update to a job as user5.2 for user's 5.1 in same group job in '@group5' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroupSpec4}`) + .patch(`/api/v3/Jobs/${encodedGroupSpecJobOwnedByUser51}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3650,7 +3656,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1580: Adds a Status update to a job as user5.2 for another user in his/her group job in '@group5' configuration", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroupSpec5}`) + .patch(`/api/v3/Jobs/${encodedGroupSpecJobOwnedByGroup5}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3663,7 +3669,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1590: Adds a Status update to a job as user3 for his/her job in '@group5' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroupSpec8}`) + .patch(`/api/v3/Jobs/${encodedGroupSpecJobOwnedByUser3}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3676,7 +3682,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1600: Adds a Status update to a job as user3 for user's 5.1 job in '@group5' configuration, which should fail as forbidden", async () => { return request(appUrl) - .patch(`/api/v3/Jobs/${encodedJobIdGroupSpec4}`) + .patch(`/api/v3/Jobs/${encodedGroupSpecJobOwnedByUser51}`) .send({ statusMessage: "update status of a job", statusCode: "job finished/blocked/etc", @@ -3883,10 +3889,10 @@ describe("1100: Jobs: Test New Job Model", () => { it("1750: Get admin's job as user from ADMIN_GROUP", async () => { return request(appUrl) - .get(`/api/v3/Jobs/${encodedJobIdUser1}`) + .get(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByAdmin}`) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) - .expect(TestData.SuccessfulPatchStatusCode) + .expect(TestData.SuccessfulGetStatusCode) .expect("Content-Type", /json/) .then((res) => { res.body.should.have.property("ownerUser").and.be.equal("admin"); @@ -3895,10 +3901,10 @@ describe("1100: Jobs: Test New Job Model", () => { it("1760: Get user1's job as user from ADMIN_GROUP", async () => { return request(appUrl) - .get(`/api/v3/Jobs/${encodedJobIdUser2}`) + .get(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByUser1}`) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) - .expect(TestData.SuccessfulPatchStatusCode) + .expect(TestData.SuccessfulGetStatusCode) .expect("Content-Type", /json/) .then((res) => { res.body.should.have.property("ownerUser").and.be.equal("user1"); @@ -3907,10 +3913,10 @@ describe("1100: Jobs: Test New Job Model", () => { it("1770: Get group1's job as user from ADMIN_GROUP", async () => { return request(appUrl) - .get(`/api/v3/Jobs/${encodedJobIdUser3}`) + .get(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByGroup1}`) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) - .expect(TestData.SuccessfulPatchStatusCode) + .expect(TestData.SuccessfulGetStatusCode) .expect("Content-Type", /json/) .then((res) => { res.body.should.not.have.property("ownerUser"); @@ -3920,10 +3926,10 @@ describe("1100: Jobs: Test New Job Model", () => { it("1780: Get admin's job as user from ADMIN_GROUP", async () => { return request(appUrl) - .get(`/api/v3/Jobs/${encodedJobIdUser6}`) + .get(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByAnonym}`) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) - .expect(TestData.SuccessfulPatchStatusCode) + .expect(TestData.SuccessfulGetStatusCode) .expect("Content-Type", /json/) .then((res) => { res.body.should.not.have.property("ownerUser"); @@ -3932,7 +3938,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1790: Get admin's job as user from CREATE_JOB_GROUP, which should be forbidden", async () => { return request(appUrl) - .get(`/api/v3/Jobs/${encodedJobIdUser1}`) + .get(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByAdmin}`) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser1}` }) .expect(TestData.AccessForbiddenStatusCode) @@ -3944,10 +3950,10 @@ describe("1100: Jobs: Test New Job Model", () => { it("1800: Get his/her own job as user from CREATE_JOB_GROUP", async () => { return request(appUrl) - .get(`/api/v3/Jobs/${encodedJobIdUser2}`) + .get(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByUser1}`) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) - .expect(TestData.SuccessfulPatchStatusCode) + .expect(TestData.SuccessfulGetStatusCode) .expect("Content-Type", /json/) .then((res) => { res.body.should.have.property("ownerUser").and.be.equal("user1"); @@ -3957,10 +3963,10 @@ describe("1100: Jobs: Test New Job Model", () => { it("1810: Get a job from his/her own group as user from CREATE_JOB_GROUP", async () => { return request(appUrl) - .get(`/api/v3/Jobs/${encodedJobIdUser3}`) + .get(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByGroup1}`) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) - .expect(TestData.SuccessfulPatchStatusCode) + .expect(TestData.SuccessfulGetStatusCode) .expect("Content-Type", /json/) .then((res) => { res.body.should.not.have.property("ownerUser"); @@ -3970,7 +3976,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1820: Get other user's job as user from CREATE_JOB_GROUP, which should be forbidden", async () => { return request(appUrl) - .get(`/api/v3/Jobs/${encodedJobIdUser4}`) + .get(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByUser51}`) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser1}` }) .expect(TestData.AccessForbiddenStatusCode) @@ -3982,7 +3988,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1830: Get anonymous user's job as user from CREATE_JOB_GROUP, which should be forbidden", async () => { return request(appUrl) - .get(`/api/v3/Jobs/${encodedJobIdUser6}`) + .get(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByAnonym}`) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser1}` }) .expect(TestData.AccessForbiddenStatusCode) @@ -3994,7 +4000,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1840: Get admin's job as normal, which should be forbidden", async () => { return request(appUrl) - .get(`/api/v3/Jobs/${encodedJobIdUser1}`) + .get(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByAdmin}`) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.AccessForbiddenStatusCode) @@ -4006,7 +4012,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1850: Get other user's job as normal user, which should be forbidden", async () => { return request(appUrl) - .get(`/api/v3/Jobs/${encodedJobIdUser2}`) + .get(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByUser1}`) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.AccessForbiddenStatusCode) @@ -4018,10 +4024,10 @@ describe("1100: Jobs: Test New Job Model", () => { it("1860: Get his/her own job as normal user", async () => { return request(appUrl) - .get(`/api/v3/Jobs/${encodedJobIdUser4}`) + .get(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByUser51}`) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) - .expect(TestData.SuccessfulPatchStatusCode) + .expect(TestData.SuccessfulGetStatusCode) .expect("Content-Type", /json/) .then((res) => { res.body.should.have.property("ownerUser").and.be.equal('user5.1'); @@ -4031,7 +4037,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1870: Get job od another user in his/her group as normal user, which should be forbidden", async () => { return request(appUrl) - .get(`/api/v3/Jobs/${encodedJobIdUserSpec7}`) + .get(`/api/v3/Jobs/${encodedUserSpecJobOwnedByUser52}`) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.AccessForbiddenStatusCode) @@ -4043,7 +4049,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1880: Get job from his/her own group as normal user, which should be forbidden", async () => { return request(appUrl) - .get(`/api/v3/Jobs/${encodedJobIdUser5}`) + .get(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByGroup5}`) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.AccessForbiddenStatusCode) @@ -4055,7 +4061,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1890: Get anonymous user's job as normal user, which should be forbidden", async () => { return request(appUrl) - .get(`/api/v3/Jobs/${encodedJobIdUser6}`) + .get(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByAnonym}`) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.AccessForbiddenStatusCode) @@ -4067,7 +4073,7 @@ describe("1100: Jobs: Test New Job Model", () => { it("1900: Get anonymous user's job as anonymous user, which should be forbidden", async () => { return request(appUrl) - .get(`/api/v3/Jobs/${encodedJobIdUser6}`) + .get(`/api/v3/Jobs/${encodedDatasetAccessJobOwnedByAnonym}`) .set("Accept", "application/json") .expect(TestData.AccessForbiddenStatusCode) .expect("Content-Type", /json/) @@ -4076,36 +4082,36 @@ describe("1100: Jobs: Test New Job Model", () => { }); }); - it("1910: Delete job 1 as Archive Manager", async () => { + it("1910: Delete job created by admin as Archive Manager", async () => { return request(appUrl) - .delete("/api/v3/jobs/" + encodedJobIdUser1) + .delete("/api/v3/jobs/" + encodedDatasetAccessJobOwnedByAdmin) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenArchiveManager}` }) .expect(TestData.SuccessfulDeleteStatusCode) .expect("Content-Type", /json/); }); - it("1920: Delete job 1 as Admin", async () => { + it("1920: Delete job created by admin as Admin", async () => { return request(appUrl) - .delete("/api/v3/jobs/" + encodedJobIdUser2) + .delete("/api/v3/jobs/" + encodedDatasetAccessJobOwnedByUser1) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.SuccessfulDeleteStatusCode) .expect("Content-Type", /json/); }); - it("1930: Delete job 1 as CREATE_JOB_GROUPS user, which should fail", async () => { + it("1930: Delete job created by admin as CREATE_JOB_GROUPS user, which should fail", async () => { return request(appUrl) - .delete("/api/v3/jobs/" + encodedJobIdUser3) + .delete("/api/v3/jobs/" + encodedDatasetAccessJobOwnedByGroup1) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser1}` }) .expect(TestData.DeleteForbiddenStatusCode) .expect("Content-Type", /json/); }); - it("1940: Delete job 1 as normal user, which should fail", async () => { + it("1940: Delete job created by admin as normal user, which should fail", async () => { return request(appUrl) - .delete("/api/v3/jobs/" + encodedJobIdUser3) + .delete("/api/v3/jobs/" + encodedDatasetAccessJobOwnedByGroup1) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenUser51}` }) .expect(TestData.DeleteForbiddenStatusCode) @@ -4464,7 +4470,7 @@ describe("1100: Jobs: Test New Job Model", () => { describe("3120: Validate Job Action", () => { it("0010: create validate job fails without required parameters", async () => { - const newDataset = { + const newJob = { ...jobValidate, jobParams: { optionalParam: false, @@ -4473,7 +4479,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.BadRequestStatusCode) @@ -4485,7 +4491,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0020: create validate job fails with the wrong types", async () => { - const newDataset = { + const newJob = { type: "validate", jobParams: { requiredParam: 123, @@ -4495,7 +4501,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.BadRequestStatusCode) @@ -4506,7 +4512,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); }); it("0030: create validate job fails with the wrong types", async () => { - const newDataset = { + const newJob = { type: "validate", jobParams: { requiredParam: "ok", @@ -4516,7 +4522,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.BadRequestStatusCode) @@ -4527,7 +4533,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); }); it("0040: create validate job fails with the wrong types", async () => { - const newDataset = { + const newJob = { type: "validate", jobParams: { requiredParam: "ok", @@ -4537,7 +4543,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.BadRequestStatusCode) @@ -4549,7 +4555,7 @@ describe("1100: Jobs: Test New Job Model", () => { }); it("0050: create validate succeeds with the right types", async () => { - const newDataset = { + const newJob = { type: "validate", jobParams: { requiredParam: "ok", @@ -4559,7 +4565,7 @@ describe("1100: Jobs: Test New Job Model", () => { return request(appUrl) .post("/api/v3/Jobs") - .send(newDataset) + .send(newJob) .set("Accept", "application/json") .set({ Authorization: `Bearer ${accessTokenAdmin}` }) .expect(TestData.EntryCreatedStatusCode) @@ -4567,7 +4573,7 @@ describe("1100: Jobs: Test New Job Model", () => { .then((res) => { res.body.should.have.property("type").and.equal("validate"); res.body.should.have.property("createdBy").and.equal("admin"); - res.body.should.have.property("jobParams").that.deep.equals(newDataset.jobParams); + res.body.should.have.property("jobParams").that.deep.equals(newJob.jobParams); jobIdValidate1 = res.body["id"]; encodedJobIdValidate1 = encodeURIComponent(jobIdValidate1);