diff --git a/.github/workflows/api-e2e.yml b/.github/workflows/api-e2e.yml index 4e5fb8eae..9669a437d 100644 --- a/.github/workflows/api-e2e.yml +++ b/.github/workflows/api-e2e.yml @@ -63,6 +63,13 @@ jobs: with: node-version: "16" + - name: Install bruno + run: npm install -g @usebruno/cli + + - name: Run tests + run: bru run --env "Admin API Docker" --insecure + working-directory: ./Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E + - name: Install newman run: npm install -g newman newman-reporter-junitfull diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/Auth/Get Token.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/Auth/Get Token.bru new file mode 100644 index 000000000..850eadc78 --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/Auth/Get Token.bru @@ -0,0 +1,22 @@ +meta { + name: Get Token + type: http + seq: 1 +} + +post { + url: {{API_URL}}/connect/token + body: formUrlEncoded + auth: none +} + +body:form-urlencoded { + grant_type: client_credentials + client_id: %7B%7BClientId%7D%7D + client_secret: %7B%7BClientSecret%7D%7D + scope: edfi_admin_api%2Ffull_access +} + +script:post-response { + bru.setEnvVar("AT",res.body.access_token); +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/Landing/Landing Page.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/Landing/Landing Page.bru new file mode 100644 index 000000000..acd0bb420 --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/Landing/Landing Page.bru @@ -0,0 +1,24 @@ +meta { + name: Landing Page + type: http + seq: 1 +} + +get { + url: {{API_URL}} + body: json + auth: none +} + +assert { + res.status: eq 200 +} + +tests { + + test("Response includes expected properties", function() { + const data = res.getBody(); + expect(data).to.have.property("version"); + expect(data).to.have.property("build"); + }); +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/User Management/Register - Already Exists.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/User Management/Register - Already Exists.bru new file mode 100644 index 000000000..0554e5da6 --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/User Management/Register - Already Exists.bru @@ -0,0 +1,41 @@ +meta { + name: Register - Already Exists + type: http + seq: 3 +} + +post { + url: {{API_URL}}/connect/register + body: formUrlEncoded + auth: none +} + +body:form-urlencoded { + ClientId: %7B%7BRegisteredClientId%7D%7D + ClientSecret: %7B%7BRegisteredClientSecret%7D%7D + DisplayName: %7B%7BUserName%7D%7D +} + +tests { + // pm.test("Status code is Bad Request", function () { + // pm.response.to.have.status(400); + // }); + // + // const response = pm.response.json(); + // + // pm.test("Response matches error format", function () { + // pm.expect(response.status).to.equal(400); + // pm.expect(response).to.have.property("title"); + // pm.expect(response).to.have.property("errors"); + // }); + // + // pm.test("Response title is helpful and accurate", function () { + // pm.expect(response.title.toLowerCase()).to.contain("validation"); + // }); + // + // pm.test("Response errors include messages by property", function () { + // pm.expect(response.errors.ClientId.length).to.equal(1); + // pm.expect(response.errors.ClientId[0]).to.contain("already exists"); + // }); + // +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/User Management/Register - Invalid.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/User Management/Register - Invalid.bru new file mode 100644 index 000000000..2c8d83a84 --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/User Management/Register - Invalid.bru @@ -0,0 +1,42 @@ +meta { + name: Register - Invalid + type: http + seq: 2 +} + +post { + url: {{API_URL}}/connect/register + body: formUrlEncoded + auth: none +} + +body:form-urlencoded { + ClientId: + ClientSecret: + DisplayName: +} + +assert { + res.status: eq 400 + res.body.title: eq Validation failed + res.body.errors: isJson {} +} + +tests { + test("Response includes validation errors", function() { + const data = res.getBody(); + const validationErrors = { + "ClientId": [ + "'Client Id' must not be empty." + ], + "ClientSecret": [ + "'Client Secret' must not be empty." + ], + "DisplayName": [ + "'Display Name' must not be empty." + ] + }; + expect(data.errors).deep.equal(validationErrors); + + }); +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/User Management/Register.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/User Management/Register.bru new file mode 100644 index 000000000..da1e4c620 --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/User Management/Register.bru @@ -0,0 +1,39 @@ +meta { + name: Register + type: http + seq: 1 +} + +post { + url: {{API_URL}}/connect/register + body: formUrlEncoded + auth: none +} + +assert { + res.status: eq 200 + res.body.title: contains Registered client +} + +script:pre-request { + const { nanoid } = require("nanoid"); + + const clientId = nanoid(); + const clientSecret = nanoid(); + const displayName = "Test"; + + req.setBody({ + clientId, + clientSecret, + displayName + }); + + bru.setVar('ClientId', clientId); + bru.setVar('ClientSecret', clientSecret); +} + +docs { + # Register + + Registers a new user +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/User Management/Token - Incorrect Secret.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/User Management/Token - Incorrect Secret.bru new file mode 100644 index 000000000..9d6523c8b --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/User Management/Token - Incorrect Secret.bru @@ -0,0 +1,42 @@ +meta { + name: Token - Incorrect Secret + type: http + seq: 8 +} + +post { + url: {{API_URL}}/connect/token + body: formUrlEncoded + auth: none +} + +body:form-urlencoded { + client_id: %7B%7BRegisteredClientId%7D%7D + client_secret: %7B%7B%24guid%7D%7D + grant_type: client_credentials + scope: edfi_admin_api%2Ffull_access +} + +script:pre-request { + // +} + +tests { + // pm.test("Status code is Unauthorized", function () { + // pm.response.to.have.status(401); + // }); + // + // const response = pm.response.json(); + // + // pm.test("Response includes error message", function () { + // pm.expect(response).to.have.property("error"); + // pm.expect(response).to.have.property("error_description"); + // pm.expect(response).to.have.property("error_uri"); + // + // pm.expect(response["error_description"]).to.contain("credentials"); + // pm.expect(response["error_description"]).to.contain("invalid"); + // }); + // + // pm.collectionVariables.unset("RegisteredClientId"); + // pm.collectionVariables.unset("RegisteredClientSecret"); +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/User Management/Token - Invalid Grant Type.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/User Management/Token - Invalid Grant Type.bru new file mode 100644 index 000000000..7e0afa1d6 --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/User Management/Token - Invalid Grant Type.bru @@ -0,0 +1,35 @@ +meta { + name: Token - Invalid Grant Type + type: http + seq: 6 +} + +post { + url: {{API_URL}}/connect/token + body: formUrlEncoded + auth: none +} + +body:form-urlencoded { + client_id: %7B%7BRegisteredClientId%7D%7D + client_secret: %7B%7BRegisteredClientSecret%7D%7D + grant_type: authorization_code + scope: edfi_admin_api%2Ffull_access +} + +tests { + // pm.test("Status code is Bad Request", function () { + // pm.response.to.have.status(400); + // }); + // + // const response = pm.response.json(); + // + // pm.test("Response includes error message", function () { + // pm.expect(response).to.have.property("error"); + // pm.expect(response).to.have.property("error_description"); + // pm.expect(response).to.have.property("error_uri"); + // + // pm.expect(response["error_description"]).to.contain("grant_type"); + // }); + // +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/User Management/Token - Invalid Scope.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/User Management/Token - Invalid Scope.bru new file mode 100644 index 000000000..86402d007 --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/User Management/Token - Invalid Scope.bru @@ -0,0 +1,39 @@ +meta { + name: Token - Invalid Scope + type: http + seq: 7 +} + +post { + url: {{API_URL}}/connect/token + body: formUrlEncoded + auth: none +} + +body:form-urlencoded { + client_id: %7B%7BRegisteredClientId%7D%7D + client_secret: %7B%7B%24guid%7D%7D + grant_type: client_credentials + scope: NOT_REAL%2FSCOPE +} + +script:pre-request { + // +} + +tests { + // pm.test("Status code is Bad Request", function () { + // pm.response.to.have.status(400); + // }); + // + // const response = pm.response.json(); + // + // pm.test("Response includes error message", function () { + // pm.expect(response).to.have.property("error"); + // pm.expect(response).to.have.property("error_description"); + // pm.expect(response).to.have.property("error_uri"); + // + // pm.expect(response["error_description"]).to.contain("scope"); + // }); + // +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/User Management/Token - Invalid.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/User Management/Token - Invalid.bru new file mode 100644 index 000000000..96029c3b2 --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/User Management/Token - Invalid.bru @@ -0,0 +1,32 @@ +meta { + name: Token - Invalid + type: http + seq: 5 +} + +post { + url: {{API_URL}}/connect/token + body: formUrlEncoded + auth: none +} + +body:form-urlencoded { + client_id: %7B%7B%24guid%7D%7D + client_secret: + grant_type: client_credentials +} + +tests { + // pm.test("Status code is Bad Request", function () { + // pm.response.to.have.status(400); + // }); + // + // const response = pm.response.json(); + // + // pm.test("Response includes error message", function () { + // pm.expect(response).to.have.property("error"); + // pm.expect(response).to.have.property("error_description"); + // pm.expect(response).to.have.property("error_uri"); + // }); + // +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/User Management/Token.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/User Management/Token.bru new file mode 100644 index 000000000..3d27147b4 --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/User Management/Token.bru @@ -0,0 +1,35 @@ +meta { + name: Token + type: http + seq: 4 +} + +post { + url: {{API_URL}}/connect/token + body: formUrlEncoded + auth: none +} + +body:form-urlencoded { + client_id: %7B%7BRegisteredClientId%7D%7D + client_secret: %7B%7BRegisteredClientSecret%7D%7D + grant_type: client_credentials + scope: edfi_admin_api%2Ffull_access +} + +tests { + // pm.test("Status code is OK", function () { + // pm.response.to.have.status(200); + // }); + // + // const response = pm.response.json(); + // + // pm.test("Response includes token", function () { + // pm.expect(response).to.have.property("access_token"); + // pm.expect(response).to.have.property("token_type"); + // pm.expect(response).to.have.property("expires_in"); + // + // pm.expect(response["token_type"]).to.equal("Bearer"); + // }); + // +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/bruno.json b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/bruno.json new file mode 100644 index 000000000..da4f3316f --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/bruno.json @@ -0,0 +1,5 @@ +{ + "version": "1", + "name": "Admin API E2E", + "type": "collection" +} \ No newline at end of file diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/environments/Admin API Docker.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/environments/Admin API Docker.bru new file mode 100644 index 000000000..1962e9e51 --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/environments/Admin API Docker.bru @@ -0,0 +1,3 @@ +vars { + API_URL: https://localhost/adminapi +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Applications - Invalid Profile.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Applications - Invalid Profile.bru new file mode 100644 index 000000000..a827ba566 --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Applications - Invalid Profile.bru @@ -0,0 +1,56 @@ +meta { + name: Applications - Invalid Profile + type: http + seq: 11 +} + +put { + url: {{API_URL}}/v1/applications/{{CreatedApplicationId}} + body: json + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +body:json { + { + "applicationId": {{CreatedApplicationId}}, + "applicationName": "Updated Application Name", + "vendorId": {{OtherApplicationVendorId}}, + "claimSetName": "Ed-Fi ODS Admin App", + "profileId": 9999, + "educationOrganizationIds": [1234] + } + +} + +script:pre-request { + // +} + +tests { + // pm.test("Status code is Bad Request", function () { + // pm.response.to.have.status(400); + // }); + // + // const response = pm.response.json(); + // const errors = pm.response.json().errors; + // + // pm.test("Response matches error format", function () { + // pm.expect(response.status).to.equal(400); + // pm.expect(response).to.have.property("title"); + // pm.expect(response).to.have.property("errors"); + // }); + // + // pm.test("Response title is helpful and accurate", function () { + // pm.expect(response.title.toLowerCase()).to.contain("validation"); + // }); + // + // pm.test("Response errors include messages by property", function () { + // pm.expect(response.errors.ProfileId.length).to.equal(1); + // pm.expect(response.errors.ProfileId[0]).to.contain("not found"); + // }); + // +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Applications - Invalid Vendor.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Applications - Invalid Vendor.bru new file mode 100644 index 000000000..f7fd66ef6 --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Applications - Invalid Vendor.bru @@ -0,0 +1,55 @@ +meta { + name: Applications - Invalid Vendor + type: http + seq: 10 +} + +put { + url: {{API_URL}}/v1/applications/{{CreatedApplicationId}} + body: json + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +body:json { + { + "applicationId": {{CreatedApplicationId}}, + "applicationName": "Updated Application Name", + "vendorId": 9999, + "claimSetName": "Ed-Fi ODS Admin App", + "profileId": null, + "educationOrganizationIds": [1234] + } + +} + +script:pre-request { + // +} + +tests { + // pm.test("Status code is Bad Request", function () { + // pm.response.to.have.status(400); + // }); + // + // const response = pm.response.json(); + // + // pm.test("Response matches error format", function () { + // pm.expect(response.status).to.equal(400); + // pm.expect(response).to.have.property("title"); + // pm.expect(response).to.have.property("errors"); + // }); + // + // pm.test("Response title is helpful and accurate", function () { + // pm.expect(response.title.toLowerCase()).to.contain("validation"); + // }); + // + // pm.test("Response errors include messages by property", function () { + // pm.expect(response.errors.VendorId.length).to.equal(1); + // pm.expect(response.errors.VendorId[0]).to.contain("not found"); + // }); + // +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Applications - Invalid.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Applications - Invalid.bru new file mode 100644 index 000000000..d76c7808f --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Applications - Invalid.bru @@ -0,0 +1,56 @@ +meta { + name: Applications - Invalid + type: http + seq: 9 +} + +put { + url: {{API_URL}}/v1/applications/{{CreatedApplicationId}} + body: json + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +body:json { + { + "applicationId": {{CreatedApplicationId}}, + "applicationName": "", + "vendorId": {{OtherApplicationVendorId}}, + "claimSetName": "", + "profileId": null, + "educationOrganizationIds": [] + } + +} + +script:pre-request { + // +} + +tests { + // pm.test("Status code is Bad Request", function () { + // pm.response.to.have.status(400); + // }); + // + // const response = pm.response.json(); + // + // pm.test("Response matches error format", function () { + // pm.expect(response.status).to.equal(400); + // pm.expect(response).to.have.property("title"); + // pm.expect(response).to.have.property("errors"); + // }); + // + // pm.test("Response title is helpful and accurate", function () { + // pm.expect(response.title.toLowerCase()).to.contain("validation"); + // }); + // + // pm.test("Response errors include messages by property", function () { + // pm.expect(response.errors["ApplicationName"].length).to.equal(1); + // pm.expect(response.errors["ClaimSetName"].length).to.equal(1); + // pm.expect(response.errors["EducationOrganizationIds"].length).to.equal(1); + // }); + // +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Applications - Not Found.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Applications - Not Found.bru new file mode 100644 index 000000000..8bfca3de8 --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Applications - Not Found.bru @@ -0,0 +1,41 @@ +meta { + name: Applications - Not Found + type: http + seq: 17 +} + +delete { + url: {{API_URL}}/v1/applications/{{CreatedApplicationId}} + body: none + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +tests { + // pm.test("Status code is Not Found", function () { + // pm.response.to.have.status(404); + // }); + // + // pm.test("Response matches error format", function () { + // const response = pm.response.json(); + // + // pm.expect(response).to.have.property("status"); + // pm.expect(response).to.have.property("title"); + // pm.expect(response.status).to.equal(404); + // }); + // + // pm.test("Response title is helpful and accurate", function () { + // const response = pm.response.json(); + // + // pm.expect(response.title).to.contain("Not found"); + // pm.expect(response.title).to.contain("application"); + // pm.expect(response.title).to.contain(pm.collectionVariables.get("CreatedApplicationId")); + // }); + // + // pm.collectionVariables.unset("ApplicationVendorId"); + // pm.collectionVariables.unset("CreatedApplicationId"); + // +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Applications by ID.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Applications by ID.bru new file mode 100644 index 000000000..3c4fe9afc --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Applications by ID.bru @@ -0,0 +1,51 @@ +meta { + name: Applications by ID + type: http + seq: 6 +} + +get { + url: {{API_URL}}/v1/applications/{{CreatedApplicationId}} + body: none + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +tests { + // pm.test("Status code is OK", function () { + // pm.response.to.have.status(200); + // }); + // + // const response = pm.response.json(); + // const result = pm.response.json().result; + // + // pm.test("Response matches success format", function () { + // pm.expect(response.status).to.equal(200); + // pm.expect(response).to.have.property("title"); + // pm.expect(response).to.have.property("result"); + // }); + // + // pm.test("Response result matches application", function () { + // const applicationId = pm.collectionVariables.get("CreatedApplicationId"); + // + // pm.expect(result.applicationId).to.equal(applicationId); + // pm.expect(result.applicationName).to.equal("Test Application"); + // pm.expect(result.claimSetName).to.equal("Ed-Fi Sandbox"); + // pm.expect(result.educationOrganizationIds).to.length(1); + // pm.expect(result.educationOrganizationIds[0]).to.equal(255901); + // pm.expect(result.profileName).to.equal(null); + // pm.expect(result.odsInstanceName).to.equal(null); + // pm.expect(result.profiles).to.length(0); + // pm.expect(result.vendorId).to.not.equal(null); + // pm.expect(result.vendorId).to.greaterThan(0); + // }); + // + // pm.test("Response result does not include key or secret", function () { + // pm.expect(result).to.not.have.property("key"); + // pm.expect(result).to.not.have.property("secret"); + // }); + // +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Applications by Vendor.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Applications by Vendor.bru new file mode 100644 index 000000000..722c8052f --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Applications by Vendor.bru @@ -0,0 +1,120 @@ +meta { + name: Applications by Vendor + type: http + seq: 7 +} + +get { + url: {{API_URL}}/v1/vendors/{{ApplicationVendorId}}/applications + body: none + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +script:pre-request { + // pm.sendRequest({ + // url: `${pm.variables.get("API_URL")}/v1/vendors`, + // method: 'POST', + // header: { + // "Content-Type": "application/json", + // "Authorization": `Bearer ${pm.collectionVariables.get("TOKEN")}` + // }, + // body: { + // mode: 'raw', + // raw:JSON.stringify({ + // "company": "Other Company", + // "namespacePrefixes": "uri://ed-fi.org", + // "contactName": "Other Application User", + // "contactEmailAddress": "otherapplication@example.com" + // }), + // } + // }, + // function (vendorErr, vendorResponse) { + // if(vendorErr) { console.log("Error in Pre-request:", vendorErr); } + // const vendorJson = vendorResponse.json(); + // if(!vendorJson.result.vendorId) { console.log('Error in Pre-request: vendorID missing from response. Response is:', vendorJson); } + // pm.collectionVariables.set("OtherApplicationVendorId", vendorJson.result.vendorId); + // + // pm.sendRequest({ + // url: `${pm.variables.get("API_URL")}/v1/applications`, + // method: 'POST', + // header: { + // "Content-Type": "application/json", + // "Authorization": `Bearer ${pm.collectionVariables.get("TOKEN")}` + // }, + // body: { + // mode: 'raw', + // raw:JSON.stringify({ + // "applicationName": "Other Vendor Application", + // "vendorId": pm.collectionVariables.get("OtherApplicationVendorId"), + // "claimSetName": "Ed-Fi Sandbox", + // "profileId": null, + // "educationOrganizationIds": [ 255901 ] + // }), + // } + // }, + // function (appErr, appResonse) { + // if(appErr) { console.log("Error in Pre-request:", appErr); } + // const appJson = appResonse.json(); + // if(!appJson.result.applicationId) { console.log('Error in Pre-request: applicationId missing from response. Response is:', appJson); } + // else { + // pm.collectionVariables.set("OtherApplicationId", appJson.result.applicationId); + // } + // }); + // }); + // +} + +tests { + // pm.test("Status code is OK", function () { + // pm.response.to.have.status(200); + // }); + // + // const response = pm.response.json(); + // const results = pm.response.json().result; + // + // pm.test("Response matches success format", function () { + // pm.expect(response.status).to.equal(200); + // pm.expect(response).to.have.property("title"); + // pm.expect(response).to.have.property("result"); + // }); + // + // pm.test("Response result includes applications", function () { + // pm.expect(results.length).to.be.greaterThan(0); + // + // const indexOfApplication = results.map( + // function(application) { return application.applicationId; } + // ).indexOf(pm.collectionVariables.get("CreatedApplicationId")); + // + // const result = results[indexOfApplication]; + // pm.expect(result.applicationName).to.equal("Test Application"); + // pm.expect(result.claimSetName).to.equal("Ed-Fi Sandbox"); + // pm.expect(result.educationOrganizationIds).to.length(1); + // pm.expect(result.educationOrganizationIds[0]).to.equal(255901); + // pm.expect(result.profileName).to.equal(null); + // pm.expect(result.odsInstanceName).to.equal(null); + // pm.expect(result.profiles).to.length(0); + // pm.expect(result.vendorId).to.not.equal(null); + // pm.expect(result.vendorId).to.greaterThan(0); + // }); + // + // pm.test("Response result is filtered by vendor", function () { + // const resultApplicationIds = results.map( + // function(application) { return application.applicationId; } + // ); + // + // pm.expect(resultApplicationIds).to.contain(pm.collectionVariables.get("CreatedApplicationId")); + // pm.expect(resultApplicationIds).to.not.contain(pm.collectionVariables.get("OtherApplicationId")); + // }); + // + // pm.test("Response results do not include key or secret", function () { + // results.forEach(function(result, i) { + // pm.expect(result).to.not.have.property("key"); + // pm.expect(result).to.not.have.property("secret"); + // }); + // }); + // +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Applications.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Applications.bru new file mode 100644 index 000000000..2fc6999df --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Applications.bru @@ -0,0 +1,33 @@ +meta { + name: Applications + type: http + seq: 13 +} + +delete { + url: {{API_URL}}/v1/applications/{{CreatedApplicationId}} + body: none + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +tests { + // pm.test("Status code is OK", function () { + // pm.response.to.have.status(200); + // }); + // + // const response = pm.response.json(); + // + // pm.test("Response matches success format", function () { + // pm.expect(response.status).to.equal(200); + // pm.expect(response).to.have.property("title"); + // }); + // + // pm.test("Response title is helpful and accurate", function () { + // pm.expect(response.title.toLowerCase()).to.contain("application"); + // pm.expect(response.title.toLowerCase()).to.contain("deleted"); + // }); +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Reset Credential - Not Found.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Reset Credential - Not Found.bru new file mode 100644 index 000000000..e1618424c --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Reset Credential - Not Found.bru @@ -0,0 +1,38 @@ +meta { + name: Reset Credential - Not Found + type: http + seq: 15 +} + +put { + url: {{API_URL}}/v1/applications/{{CreatedApplicationId}}/reset-credential + body: none + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +tests { + // pm.test("Status code is Not Found", function () { + // pm.response.to.have.status(404); + // }); + // + // pm.test("Response matches error format", function () { + // const response = pm.response.json(); + // + // pm.expect(response).to.have.property("status"); + // pm.expect(response).to.have.property("title"); + // pm.expect(response.status).to.equal(404); + // }); + // + // pm.test("Response title is helpful and accurate", function () { + // const response = pm.response.json(); + // + // pm.expect(response.title).to.contain("Not found"); + // pm.expect(response.title).to.contain("application"); + // pm.expect(response.title).to.contain(pm.collectionVariables.get("CreatedApplicationId")); + // }); + // +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Reset Credential.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Reset Credential.bru new file mode 100644 index 000000000..09cc2c56f --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Application/Reset Credential.bru @@ -0,0 +1,42 @@ +meta { + name: Reset Credential + type: http + seq: 12 +} + +put { + url: {{API_URL}}/v1/applications/{{CreatedApplicationId}}/reset-credential + body: none + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +tests { + // pm.test("Status code is OK", function () { + // pm.response.to.have.status(200); + // }); + // + // const response = pm.response.json(); + // const result = pm.response.json().result; + // + // pm.test("Response matches success format", function () { + // pm.expect(response.status).to.equal(200); + // pm.expect(response).to.have.property("title"); + // pm.expect(response).to.have.property("result"); + // }); + // + // pm.test("Response title is helpful and accurate", function () { + // pm.expect(response.title.toLowerCase()).to.contain("application"); + // pm.expect(response.title.toLowerCase()).to.contain("updated"); + // }); + // + // pm.test("Response result includes application key and secret", function () { + // pm.expect(result).to.have.property("applicationId"); + // pm.expect(result).to.have.property("key"); + // pm.expect(result).to.have.property("secret"); + // }); + // +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - Invalid Existing ClaimSet Name.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - Invalid Existing ClaimSet Name.bru new file mode 100644 index 000000000..b467b6988 --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - Invalid Existing ClaimSet Name.bru @@ -0,0 +1,50 @@ +meta { + name: ClaimSets - Invalid Existing ClaimSet Name + type: http + seq: 16 +} + +put { + url: {{API_URL}}/v1/claimsets/{{CreatedClaimSetId}} + body: json + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +body:json { + { + "id": {{CreatedClaimSetId}}, + "name": "Other Test ClaimSet {{OtherClaimSetGUID}}", + "resourceClaims": [] + } +} + +script:pre-request { + // +} + +tests { + // pm.test("Status code is Bad Request", function () { + // pm.response.to.have.status(400); + // }); + // + // const response = pm.response.json(); + // + // pm.test("Response matches error format", function () { + // pm.expect(response.status).to.equal(400); + // pm.expect(response).to.have.property("title"); + // pm.expect(response).to.have.property("errors"); + // }); + // + // pm.test("Response title is helpful and accurate", function () { + // pm.expect(response.title.toLowerCase()).to.contain("validation"); + // }); + // + // pm.test("Response errors include messages by property", function () { + // pm.expect(response.errors.Name.length).to.equal(1); + // pm.expect(response.errors.Name[0]).to.contain("already exists"); + // }); +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - Invalid JSON.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - Invalid JSON.bru new file mode 100644 index 000000000..372636c86 --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - Invalid JSON.bru @@ -0,0 +1,62 @@ +meta { + name: ClaimSets - Invalid JSON + type: http + seq: 15 +} + +put { + url: {{API_URL}}/v1/claimsets/{{CreatedClaimSetId}} + body: json + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +body:json { + { + "id": {{CreatedClaimSetId}}, + "noname": "Not-Valid", + "window": { + "title": "Sample Konfabulator Widget", + "name": "main_window", + "width": 500, + "height": 500 + }, + "image": { + "src": "Images/Sun.png", + "name": "sun1", + "hOffset": 250, + "vOffset": 250, + "alignment": "center" + } + } + +} + +script:pre-request { + // +} + +tests { + // pm.test("Status code is Bad Request", function () { + // pm.response.to.have.status(400); + // }); + // + // const response = pm.response.json(); + // + // pm.test("Response matches error format", function () { + // pm.expect(response.status).to.equal(400); + // pm.expect(response).to.have.property("title"); + // pm.expect(response).to.have.property("errors"); + // }); + // + // pm.test("Response title is helpful and accurate", function () { + // pm.expect(response.title.toLowerCase()).to.contain("validation"); + // }); + // + // pm.test("Response errors include messages by property", function () { + // pm.expect(response.errors["Name"].length).to.equal(1); + // }); +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - Invalid Resource Duplication.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - Invalid Resource Duplication.bru new file mode 100644 index 000000000..41bff70b5 --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - Invalid Resource Duplication.bru @@ -0,0 +1,183 @@ +meta { + name: ClaimSets - Invalid Resource Duplication + type: http + seq: 19 +} + +put { + url: {{API_URL}}/v1/claimsets/{{CreatedClaimSetId}} + body: json + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +body:json { + { + "id": {{CreatedClaimSetId}}, + "name": "Resource-Duplication", + "resourceClaims": [ + { + "name": "educationStandards", + "read": true, + "create": true, + "update": true, + "delete": true, + "defaultAuthStrategiesForCRUD": [ + { + "authStrategyName": "NamespaceBased", + "isInheritedFromParent": false + }, + { + "authStrategyName": "NoFurtherAuthorizationRequired", + "isInheritedFromParent": false + }, + { + "authStrategyName": "NamespaceBased", + "isInheritedFromParent": false + }, + { + "authStrategyName": "NamespaceBased", + "isInheritedFromParent": false + } + ], + "authStrategyOverridesForCRUD": [ + null, + null, + null, + null + ], + "children": [ + { + "name": "learningObjective", + "read": true, + "create": true, + "update": true, + "delete": true, + "defaultAuthStrategiesForCRUD": [ + { + "authStrategyName": "NamespaceBased", + "isInheritedFromParent": true + }, + { + "authStrategyName": "NoFurtherAuthorizationRequired", + "isInheritedFromParent": true + }, + { + "authStrategyName": "NamespaceBased", + "isInheritedFromParent": true + }, + { + "authStrategyName": "NamespaceBased", + "isInheritedFromParent": true + } + ], + "authStrategyOverridesForCRUD": [ + null, + null, + null, + null + ], + "children": [] + }, + { + "name": "learningObjective", + "read": true, + "create": true, + "update": true, + "delete": true, + "defaultAuthStrategiesForCRUD": [ + { + "authStrategyName": "NamespaceBased", + "isInheritedFromParent": true + }, + { + "authStrategyName": "NoFurtherAuthorizationRequired", + "isInheritedFromParent": true + }, + { + "authStrategyName": "NamespaceBased", + "isInheritedFromParent": true + }, + { + "authStrategyName": "NamespaceBased", + "isInheritedFromParent": true + } + ], + "authStrategyOverridesForCRUD": [ + null, + null, + null, + null + ], + "children": [] + } + ] + }, + { + "name": "academicSubjectDescriptor", + "read": true, + "create": true, + "update": true, + "delete": true, + "defaultAuthStrategiesForCRUD": [ + { + "authStrategyName": "NamespaceBased", + "isInheritedFromParent": true + }, + { + "authStrategyName": "NoFurtherAuthorizationRequired", + "isInheritedFromParent": true + }, + { + "authStrategyName": "NamespaceBased", + "isInheritedFromParent": true + }, + { + "authStrategyName": "NamespaceBased", + "isInheritedFromParent": true + } + ], + "authStrategyOverridesForCRUD": [ + null, + null, + null, + null + ], + "children": [] + } + ] + } +} + +script:pre-request { + // +} + +tests { + // pm.test("Status code is Bad Request", function () { + // pm.response.to.have.status(400); + // }); + // + // const response = pm.response.json(); + // const errors = pm.response.json().errors; + // + // pm.test("Response matches error format", function () { + // pm.expect(response.status).to.equal(400); + // pm.expect(response).to.have.property("title"); + // pm.expect(response).to.have.property("errors"); + // }); + // + // pm.test("Response title is helpful and accurate", function () { + // pm.expect(response.title.toLowerCase()).to.contain("validation"); + // }); + // + // pm.test("Response errors include messages by property and resource", function () { + // pm.expect(response.errors.ResourceClaims.length).to.equal(1); + // ["Only unique resource claims", "duplicate resource: 'learningObjective'"].forEach((substring) => { + // pm.expect(response.errors.ResourceClaims[0]).to.contain(substring); + // }); + // }); +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - Invalid Wrong Parent Child Relationship.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - Invalid Wrong Parent Child Relationship.bru new file mode 100644 index 000000000..77b0c21a0 --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - Invalid Wrong Parent Child Relationship.bru @@ -0,0 +1,151 @@ +meta { + name: ClaimSets - Invalid Wrong Parent Child Relationship + type: http + seq: 18 +} + +put { + url: {{API_URL}}/v1/claimsets/{{CreatedClaimSetId}} + body: json + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +body:json { + { + "id": {{CreatedClaimSetId}}, + "name": "Wrong-Parent-Child-Relation", + "resourceClaims": [ + { + "name": "educationStandards", + "read": true, + "create": true, + "update": true, + "delete": true, + "defaultAuthStrategiesForCRUD": [ + { + "authStrategyName": "NamespaceBased", + "isInheritedFromParent": false + }, + { + "authStrategyName": "NoFurtherAuthorizationRequired", + "isInheritedFromParent": false + }, + { + "authStrategyName": "NamespaceBased", + "isInheritedFromParent": false + }, + { + "authStrategyName": "NamespaceBased", + "isInheritedFromParent": false + } + ], + "authStrategyOverridesForCRUD": [ + null, + null, + null, + null + ], + "children": [ + { + "name": "academicSubjectDescriptor", + "read": true, + "create": true, + "update": true, + "delete": true, + "defaultAuthStrategiesForCRUD": [ + { + "authStrategyName": "NamespaceBased", + "isInheritedFromParent": true + }, + { + "authStrategyName": "NoFurtherAuthorizationRequired", + "isInheritedFromParent": true + }, + { + "authStrategyName": "NamespaceBased", + "isInheritedFromParent": true + }, + { + "authStrategyName": "NamespaceBased", + "isInheritedFromParent": true + } + ], + "authStrategyOverridesForCRUD": [ + null, + null, + null, + null + ], + "children": [] + } + ] + }, + { + "name": "academicSubjectDescriptor", + "read": true, + "create": true, + "update": true, + "delete": true, + "defaultAuthStrategiesForCRUD": [ + { + "authStrategyName": "NamespaceBased", + "isInheritedFromParent": true + }, + { + "authStrategyName": "NoFurtherAuthorizationRequired", + "isInheritedFromParent": true + }, + { + "authStrategyName": "NamespaceBased", + "isInheritedFromParent": true + }, + { + "authStrategyName": "NamespaceBased", + "isInheritedFromParent": true + } + ], + "authStrategyOverridesForCRUD": [ + null, + null, + null, + null + ], + "children": [] + } + ] + } +} + +script:pre-request { + // +} + +tests { + // pm.test("Status code is Bad Request", function () { + // pm.response.to.have.status(400); + // }); + // + // const response = pm.response.json(); + // const errors = pm.response.json().errors; + // + // pm.test("Response matches error format", function () { + // pm.expect(response.status).to.equal(400); + // pm.expect(response).to.have.property("title"); + // pm.expect(response).to.have.property("errors"); + // }); + // + // pm.test("Response title is helpful and accurate", function () { + // pm.expect(response.title.toLowerCase()).to.contain("validation"); + // }); + // + // pm.test("Response errors include messages by property and resource", function () { + // pm.expect(response.errors.ResourceClaims.length).to.equal(1); + // ["Child resource: 'academicSubjectDescriptor'", "wrong parent resource", "parent resource is: 'systemDescriptors'"].forEach((substring) => { + // pm.expect(response.errors.ResourceClaims[0]).to.contain(substring); + // }); + // }); +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - Invalid Wrong Resource Name.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - Invalid Wrong Resource Name.bru new file mode 100644 index 000000000..787134ae4 --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - Invalid Wrong Resource Name.bru @@ -0,0 +1,106 @@ +meta { + name: ClaimSets - Invalid Wrong Resource Name + type: http + seq: 17 +} + +put { + url: {{API_URL}}/v1/claimsets/{{CreatedClaimSetId}} + body: json + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +body:json { + { + "id": {{CreatedClaimSetId}}, + "name": "ClaimSet-WithWrongResource", + "resourceClaims": [ + { + "name": "educationStandards-123", + "read": true, + "create": true, + "update": true, + "delete": true, + "readChanges": true, + "authStrategyOverridesForCRUD": [ + null, + null, + null, + null, + null + ], + "children": [ + { + "name": "learningObjective-123", + "read": true, + "create": true, + "update": true, + "delete": true, + "readChanges": true, + "authStrategyOverridesForCRUD": [ + null, + null, + null, + null, + null + ], + "children": [] + } + ] + }, + { + "name": "academicSubjectDescriptor", + "read": true, + "create": true, + "update": true, + "delete": true, + "readChanges": true, + "authStrategyOverridesForCRUD": [ + null, + null, + null, + null, + null + ], + "children": [] + } + ] + } +} + +script:pre-request { + // +} + +tests { + // pm.test("Status code is Bad Request", function () { + // pm.response.to.have.status(400); + // }); + // + // const response = pm.response.json(); + // const errors = pm.response.json().errors; + // + // pm.test("Response matches error format", function () { + // pm.expect(response.status).to.equal(400); + // pm.expect(response).to.have.property("title"); + // pm.expect(response).to.have.property("errors"); + // }); + // + // pm.test("Response title is helpful and accurate", function () { + // pm.expect(response.title.toLowerCase()).to.contain("validation"); + // }); + // + // pm.test("Response errors include messages by property and resource", function () { + // pm.expect(response.errors.ResourceClaims.length).to.equal(2); + // ["not in the system", "educationStandards-123"].forEach((substring) => { + // pm.expect(response.errors.ResourceClaims[0]).to.contain(substring); + // }); + // ["not in the system", "learningObjective-123"].forEach((substring) => { + // pm.expect(response.errors.ResourceClaims[1]).to.contain(substring); + // }); + // }); +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - Invalid.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - Invalid.bru new file mode 100644 index 000000000..26ec580ca --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - Invalid.bru @@ -0,0 +1,50 @@ +meta { + name: ClaimSets - Invalid + type: http + seq: 14 +} + +put { + url: {{API_URL}}/v1/claimsets/{{CreatedClaimSetId}} + body: json + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +body:json { + { + "id": {{CreatedClaimSetId}}, + "name": "", + "resourceClaims": [] + } + +} + +script:pre-request { + // +} + +tests { + // pm.test("Status code is Bad Request", function () { + // pm.response.to.have.status(400); + // }); + // + // const response = pm.response.json(); + // + // pm.test("Response matches error format", function () { + // pm.expect(response.status).to.equal(400); + // pm.expect(response).to.have.property("title"); + // pm.expect(response).to.have.property("errors"); + // }); + // + // pm.test("Response title is helpful and accurate", function () { + // pm.expect(response.title.toLowerCase()).to.contain("validation"); + // }); + // + // pm.test("Response errors include messages by property", function () { + // pm.expect(response.errors["Name"].length).to.equal(1); + // }); +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - Not Found.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - Not Found.bru new file mode 100644 index 000000000..4034f5837 --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - Not Found.bru @@ -0,0 +1,42 @@ +meta { + name: ClaimSets - Not Found + type: http + seq: 27 +} + +delete { + url: {{API_URL}}/v1/claimsets/{{CreatedClaimSetId}} + body: none + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +tests { + // pm.test("Status code is Not Found", function () { + // pm.response.to.have.status(404); + // }); + // + // pm.test("Response matches error format", function () { + // const response = pm.response.json(); + // + // pm.expect(response).to.have.property("status"); + // pm.expect(response).to.have.property("title"); + // pm.expect(response.status).to.equal(404); + // }); + // + // pm.test("Response title is helpful and accurate", function () { + // const response = pm.response.json(); + // + // pm.expect(response.title).to.contain("Not found"); + // pm.expect(response.title).to.contain("claimset"); + // pm.expect(response.title).to.contain(pm.collectionVariables.get("CreatedClaimSetId")); + // }); + // + // pm.collectionVariables.unset("CreatedClaimSetId"); + // pm.collectionVariables.unset("OtherExistingClaimSetId"); + // pm.collectionVariables.unset("ClaimSetGUID"); + // pm.collectionVariables.unset("OtherClaimSetGUID"); +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - Override.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - Override.bru new file mode 100644 index 000000000..c787511bc --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - Override.bru @@ -0,0 +1,34 @@ +meta { + name: ClaimSets - Override + type: http + seq: 22 +} + +delete { + url: {{API_URL}}/v1/claimsets/{{CreatedClaimSetIdOverride}} + body: none + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +tests { + // pm.test("Status code is OK", function () { + // pm.response.to.have.status(200); + // }); + // + // const response = pm.response.json(); + // + // pm.test("Response matches success format", function () { + // pm.expect(response.status).to.equal(200); + // pm.expect(response).to.have.property("title"); + // }); + // + // pm.test("Response title is helpful and accurate", function () { + // pm.expect(response.title.toLowerCase()).to.contain("claimset"); + // pm.expect(response.title.toLowerCase()).to.contain("deleted"); + // }); + // +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - System Reserved.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - System Reserved.bru new file mode 100644 index 000000000..0655368d0 --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - System Reserved.bru @@ -0,0 +1,47 @@ +meta { + name: ClaimSets - System Reserved + type: http + seq: 23 +} + +delete { + url: {{API_URL}}/v1/claimsets/{{SystemReservedClaimSetId}} + body: none + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +script:pre-request { + // +} + +tests { + // pm.test("Status code is Bad Request", function () { + // pm.response.to.have.status(400); + // }); + // + // const response = pm.response.json(); + // + // pm.test("Response matches error format", function () { + // pm.expect(response.status).to.equal(400); + // pm.expect(response).to.have.property("title"); + // pm.expect(response).to.have.property("errors"); + // }); + // + // pm.test("Response title is helpful and accurate", function () { + // pm.expect(response.title.toLowerCase()).to.contain("validation"); + // }); + // + // pm.test("Response errors include messages by property", function () { + // pm.expect(response.errors["id"].length).to.equal(1); + // ["AB Connect", "system reserved"].forEach((substring) => { + // pm.expect(response.errors.id[0]).to.contain(substring); + // }); + // }); + // + // pm.collectionVariables.unset("SystemReservedClaimSetId"); + // +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - With Applications.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - With Applications.bru new file mode 100644 index 000000000..5dfd3ba94 --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets - With Applications.bru @@ -0,0 +1,48 @@ +meta { + name: ClaimSets - With Applications + type: http + seq: 24 +} + +delete { + url: {{API_URL}}/v1/claimsets/{{OtherExistingClaimSetId}} + body: none + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +script:pre-request { + // +} + +tests { + // pm.test("Status code is Bad Request", function () { + // pm.response.to.have.status(400); + // }); + // + // const response = pm.response.json(); + // + // pm.test("Response matches error format", function () { + // pm.expect(response.status).to.equal(400); + // pm.expect(response).to.have.property("title"); + // pm.expect(response).to.have.property("errors"); + // }); + // + // pm.test("Response title is helpful and accurate", function () { + // pm.expect(response.title.toLowerCase()).to.contain("validation"); + // }); + // + // pm.test("Response errors include messages by property", function () { + // pm.expect(response.errors["id"].length).to.equal(1); + // ["Cannot delete", "associated application"].forEach((substring) => { + // pm.expect(response.errors.id[0]).to.contain(substring); + // }); + // }); + // + // pm.collectionVariables.unset("OtherApplicationId"); + // pm.collectionVariables.unset("OtherApplicationVendorId"); + // +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets by ID - Override.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets by ID - Override.bru new file mode 100644 index 000000000..786999e6a --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets by ID - Override.bru @@ -0,0 +1,48 @@ +meta { + name: ClaimSets by ID - Override + type: http + seq: 11 +} + +get { + url: {{API_URL}}/v1/claimsets/{{CreatedClaimSetIdOverride}} + body: none + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +tests { + // pm.test("Status code is OK", function () { + // pm.response.to.have.status(200); + // }); + // + // const response = pm.response.json(); + // const result = pm.response.json().result; + // + // pm.test("Response matches success format", function () { + // pm.expect(response.status).to.equal(200); + // pm.expect(response).to.have.property("title"); + // pm.expect(response).to.have.property("result"); + // }); + // + // pm.test("Response result matches claimset", function () { + // const claimSetId = pm.collectionVariables.get("CreatedClaimSetIdOverride"); + // + // pm.expect(result.id).to.equal(claimSetId); + // pm.expect(result.name).to.equal(`Test ClaimSet ${pm.collectionVariables.get("ClaimSetOverrideGUID")}`); + // pm.expect(result.isSystemReserved).to.equal(false); + // pm.expect(result.applicationsCount).to.equal(0); + // pm.expect(result.resourceClaims).to.not.be.empty; + // const educationStandardsResourceClaim = result.resourceClaims.find(r => r.name === "educationStandards") + // pm.expect(educationStandardsResourceClaim).to.be.an("object", "The educationStandards resource claim was not found.") + // pm.expect(educationStandardsResourceClaim.authStrategyOverridesForCRUD).to.not.be.empty; + // pm.expect(educationStandardsResourceClaim.authStrategyOverridesForCRUD[1]).to.be.an("object", "The override for read action in resource claim educationStandards was not found.") + // + // const academicSubjectDescriptorResourceClaim = result.resourceClaims.find(r => r.name === "academicSubjectDescriptor") + // pm.expect(academicSubjectDescriptorResourceClaim).to.be.an("object", "The academicSubjectDescriptor resource claim was not found.") + // }); + // +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets by ID.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets by ID.bru new file mode 100644 index 000000000..20d9e995a --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets by ID.bru @@ -0,0 +1,45 @@ +meta { + name: ClaimSets by ID + type: http + seq: 10 +} + +get { + url: {{API_URL}}/v1/claimsets/{{CreatedClaimSetId}} + body: none + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +tests { + // pm.test("Status code is OK", function () { + // pm.response.to.have.status(200); + // }); + // + // const response = pm.response.json(); + // const result = pm.response.json().result; + // + // pm.test("Response matches success format", function () { + // pm.expect(response.status).to.equal(200); + // pm.expect(response).to.have.property("title"); + // pm.expect(response).to.have.property("result"); + // }); + // + // pm.test("Response result matches claimset", function () { + // const claimSetId = pm.collectionVariables.get("CreatedClaimSetId"); + // + // pm.expect(result.id).to.equal(claimSetId); + // pm.expect(result.name).to.equal(`Test ClaimSet ${pm.collectionVariables.get("ClaimSetGUID")}`); + // pm.expect(result.isSystemReserved).to.equal(false); + // pm.expect(result.applicationsCount).to.equal(0); + // pm.expect(result.resourceClaims).to.not.be.empty; + // const educationStandardsResourceClaim = result.resourceClaims.find(r => r.name === "educationStandards") + // pm.expect(educationStandardsResourceClaim).to.be.an("object", "The educationStandards resource claim was not found.") + // const academicSubjectDescriptorResourceClaim = result.resourceClaims.find(r => r.name === "academicSubjectDescriptor") + // pm.expect(academicSubjectDescriptorResourceClaim).to.be.an("object", "The academicSubjectDescriptor resource claim was not found.") + // }); + // +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets.bru new file mode 100644 index 000000000..5e89a40ef --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/ClaimSets/ClaimSets.bru @@ -0,0 +1,34 @@ +meta { + name: ClaimSets + type: http + seq: 21 +} + +delete { + url: {{API_URL}}/v1/claimsets/{{CreatedClaimSetId}} + body: none + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +tests { + // pm.test("Status code is OK", function () { + // pm.response.to.have.status(200); + // }); + // + // const response = pm.response.json(); + // + // pm.test("Response matches success format", function () { + // pm.expect(response.status).to.equal(200); + // pm.expect(response).to.have.property("title"); + // }); + // + // pm.test("Response title is helpful and accurate", function () { + // pm.expect(response.title.toLowerCase()).to.contain("claimset"); + // pm.expect(response.title.toLowerCase()).to.contain("deleted"); + // }); + // +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Vendors/Vendor.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Vendors/Vendor.bru new file mode 100644 index 000000000..0cf50132d --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Vendors/Vendor.bru @@ -0,0 +1,30 @@ +meta { + name: Vendor + type: http + seq: 1 +} + +post { + url: {{API_URL}}/v1/vendors + body: json + auth: bearer +} + +auth:bearer { + token: {{AT}} +} + +body:json { + { + "company": "Test Company", + "namespacePrefixes": "uri://ed-fi.org", + "contactName": "Test User", + "contactEmailAddress": "test@test-ed-fi.org" + } +} + +assert { + res.status: eq 201 + res.body.result.vendorId: isNumber + res.body.title: eq Vendor created successfully +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Vendors/Vendors - Not Found.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Vendors/Vendors - Not Found.bru new file mode 100644 index 000000000..cc14441fb --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Vendors/Vendors - Not Found.bru @@ -0,0 +1,38 @@ +meta { + name: Vendors - Not Found + type: http + seq: 4 +} + +get { + url: {{API_URL}}/v1/vendors/{{CreatedVendorId}} + body: none + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +tests { + // pm.test("Status code is Not Found", function () { + // pm.response.to.have.status(404); + // }); + // + // pm.test("Response matches error format", function () { + // const response = pm.response.json(); + // + // pm.expect(response).to.have.property("status"); + // pm.expect(response).to.have.property("title"); + // pm.expect(response.status).to.equal(404); + // }); + // + // pm.test("Response title is helpful and accurate", function () { + // const response = pm.response.json(); + // + // pm.expect(response.title).to.contain("Not found"); + // pm.expect(response.title).to.contain("vendor"); + // pm.expect(response.title).to.contain(pm.collectionVariables.get("CreatedVendorId")); + // }); + // +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Vendors/Vendors - Invalid.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Vendors/Vendors - Invalid.bru new file mode 100644 index 000000000..8bc2d78e4 --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Vendors/Vendors - Invalid.bru @@ -0,0 +1,52 @@ +meta { + name: Vendors - Invalid + type: http + seq: 5 +} + +put { + url: {{API_URL}}/v1/vendors/{{CreatedVendorId}} + body: json + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +body:json { + { + "company": "", + "contactName": "", + "contactEmailAddress": "" + } +} + +script:pre-request { + // +} + +tests { + // pm.test("Status code is Bad Request", function () { + // pm.response.to.have.status(400); + // }); + // + // const response = pm.response.json(); + // + // pm.test("Response matches error format", function () { + // pm.expect(response.status).to.equal(400); + // pm.expect(response).to.have.property("title"); + // pm.expect(response).to.have.property("errors"); + // }); + // + // pm.test("Response title is helpful and accurate", function () { + // pm.expect(response.title.toLowerCase()).to.contain("validation"); + // }); + // + // pm.test("Response errors include messages by property", function () { + // pm.expect(response.errors["Company"].length).to.equal(1); + // pm.expect(response.errors["ContactName"].length).to.equal(1); + // pm.expect(response.errors["ContactEmailAddress"].length).to.equal(2); + // }); + // +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Vendors/Vendors - Not Found.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Vendors/Vendors - Not Found.bru new file mode 100644 index 000000000..b1ff44764 --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Vendors/Vendors - Not Found.bru @@ -0,0 +1,40 @@ +meta { + name: Vendors - Not Found + type: http + seq: 6 +} + +delete { + url: {{API_URL}}/v1/vendors/{{CreatedVendorId}} + body: none + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +tests { + // pm.test("Status code is Not Found", function () { + // pm.response.to.have.status(404); + // }); + // + // pm.test("Response matches error format", function () { + // const response = pm.response.json(); + // + // pm.expect(response).to.have.property("status"); + // pm.expect(response).to.have.property("title"); + // pm.expect(response.status).to.equal(404); + // }); + // + // pm.test("Response title is helpful and accurate", function () { + // const response = pm.response.json(); + // + // pm.expect(response.title).to.contain("Not found"); + // pm.expect(response.title).to.contain("vendor"); + // pm.expect(response.title).to.contain(pm.collectionVariables.get("CreatedVendorId")); + // }); + // + // pm.collectionVariables.unset("CreatedVendorId"); + // +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Vendors/Vendors by ID.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Vendors/Vendors by ID.bru new file mode 100644 index 000000000..a69e8f5a7 --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Vendors/Vendors by ID.bru @@ -0,0 +1,41 @@ +meta { + name: Vendors by ID + type: http + seq: 2 +} + +get { + url: {{API_URL}}/v1/vendors/{{CreatedVendorId}} + body: none + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +tests { + // pm.test("Status code is OK", function () { + // pm.response.to.have.status(200); + // }); + // + // const response = pm.response.json(); + // const result = pm.response.json().result; + // + // pm.test("Response matches success format", function () { + // pm.expect(response.status).to.equal(200); + // pm.expect(response).to.have.property("title"); + // pm.expect(response).to.have.property("result"); + // }); + // + // pm.test("Response result matches vendor", function () { + // const vendorId = pm.collectionVariables.get("CreatedVendorId"); + // + // pm.expect(result.vendorId).to.equal(vendorId); + // pm.expect(result.company).to.equal("Test Company"); + // pm.expect(result.namespacePrefixes).to.equal("uri://ed-fi.org"); + // pm.expect(result.contactName).to.equal("Test User"); + // pm.expect(result.contactEmailAddress).to.equal("test@test-ed-fi.org"); + // }); + // +} diff --git a/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Vendors/Vendors.bru b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Vendors/Vendors.bru new file mode 100644 index 000000000..f7b553a3f --- /dev/null +++ b/Application/EdFi.Ods.AdminApi/E2E Tests/bruno/Admin API E2E/v1/Vendors/Vendors.bru @@ -0,0 +1,34 @@ +meta { + name: Vendors + type: http + seq: 3 +} + +delete { + url: {{API_URL}}/v1/vendors/{{CreatedVendorId}} + body: none + auth: bearer +} + +auth:bearer { + token: {{TOKEN}} +} + +tests { + // pm.test("Status code is OK", function () { + // pm.response.to.have.status(200); + // }); + // + // const response = pm.response.json(); + // + // pm.test("Response matches success format", function () { + // pm.expect(response.status).to.equal(200); + // pm.expect(response).to.have.property("title"); + // }); + // + // pm.test("Response title is helpful and accurate", function () { + // pm.expect(response.title.toLowerCase()).to.contain("vendor"); + // pm.expect(response.title.toLowerCase()).to.contain("deleted"); + // }); + // +}