{ "info": { "_postman_id": "cd31bdf9-d558-42da-9231-154721476cd2", "name": "Pingvin Share Testing", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "_exporter_id": "17822132" }, "item": [ { "name": "_setup", "item": [ { "name": "Sign Up", "event": [ { "listen": "test", "script": { "exec": [ "if(pm.response.to.have.status(201)){", " const token = pm.response.json()[\"accessToken\"]", " // Get user id", " const jwtPayload = JSON.parse(atob(token.split('.')[1]));", " const userId = jwtPayload[\"sub\"]", " pm.collectionVariables.set(\"USER_ID\", userId)", "", " pm.collectionVariables.set(\"COOKIES\", pm.response.headers.get(\"Set-Cookie\"))", "}", "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"email\": \"system@test.org\",\n \"username\": \"system.test\",\n \"password\": \"J2y8unpJUcJDRv\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{API_URL}}/auth/signUp", "host": [ "{{API_URL}}" ], "path": [ "auth", "signUp" ] } }, "response": [] } ] }, { "name": "Auth", "item": [ { "name": "Positive", "item": [ { "name": "Sign Up", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 201\", () => {", " pm.response.to.have.status(201);", "});", "", "pm.test(\"Response contains tokens\", () => {", " const responseBody = pm.response.json();", " pm.expect(responseBody).to.have.property(\"accessToken\")", " pm.expect(responseBody).to.have.property(\"refreshToken\")", "});", "", "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Accept-Language", "value": "de", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"email\": \"system2@test.org\",\n \"username\": \"system2.test\",\n \"password\": \"N44HcHgeuAvfCT\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{API_URL}}/auth/signUp", "host": [ "{{API_URL}}" ], "path": [ "auth", "signUp" ] } }, "response": [] }, { "name": "Sign In", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 200\", () => {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response contains tokens\", () => {", " const responseBody = pm.response.json();", " pm.expect(responseBody).to.have.property(\"accessToken\")", " pm.expect(responseBody).to.have.property(\"refreshToken\")", "});", "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Accept-Language", "value": "de", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"email\": \"system2@test.org\",\n \"password\": \"N44HcHgeuAvfCT\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{API_URL}}/auth/signIn", "host": [ "{{API_URL}}" ], "path": [ "auth", "signIn" ] } }, "response": [] } ] }, { "name": "Negative", "item": [ { "name": "Sign Up - Without email", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 400\", () => {", " pm.response.to.have.status(400);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Accept-Language", "value": "de", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"password\": \"N44HcHgeuAvfCT\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{API_URL}}/auth/signUp", "host": [ "{{API_URL}}" ], "path": [ "auth", "signUp" ] } }, "response": [] }, { "name": "Sign Up - Without password", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 400\", () => {", " pm.response.to.have.status(400);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Accept-Language", "value": "de", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"email\": \"system3@test.org\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{API_URL}}/auth/signUp", "host": [ "{{API_URL}}" ], "path": [ "auth", "signUp" ] } }, "response": [] }, { "name": "Sign In - Wrong email", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 401\", () => {", " pm.response.to.have.status(401);", "});", "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Accept-Language", "value": "de", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"email\": \"wrong-email@test.org\",\n \"password\": \"N44HcHgeuAvfCT\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{API_URL}}/auth/signIn", "host": [ "{{API_URL}}" ], "path": [ "auth", "signIn" ] } }, "response": [] }, { "name": "Sign In - Wrong password", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 401\", () => {", " pm.response.to.have.status(401);", "});", "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Accept-Language", "value": "de", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"email\": \"system2@test.org\",\n \"password\": \"wrong-password\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{API_URL}}/auth/signIn", "host": [ "{{API_URL}}" ], "path": [ "auth", "signIn" ] } }, "response": [] } ] } ] }, { "name": "Create Share", "item": [ { "name": "Positive", "item": [ { "name": "Check share id availability", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 200\", () => {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response body correct\", () => {", " const responseBody = pm.response.json();", " pm.expect(responseBody.isAvailable).to.be.equal(true)", " pm.expect(Object.keys(responseBody).length).be.equal(1)", "});", "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{API_URL}}/shares/isShareIdAvailable/:id", "host": [ "{{API_URL}}" ], "path": [ "shares", "isShareIdAvailable", ":id" ], "variable": [ { "key": "id", "value": "test-share" } ] } }, "response": [] }, { "name": "Create Share", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 201\", () => {", " pm.response.to.have.status(201);", "});", "", "pm.test(\"Response body correct\", () => {", " const responseBody = pm.response.json();", " pm.expect(responseBody).to.have.property(\"id\")", " pm.expect(responseBody).to.have.property(\"expiration\")", " pm.expect(Object.keys(responseBody).length).be.equal(3)", "});", "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"id\": \"test-share\",\n \"expiration\": \"1-day\",\n \"recipients\": [],\n \"security\": {\n \"password\": \"share-password\",\n \"maxViews\": 1\n }\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{API_URL}}/shares", "host": [ "{{API_URL}}" ], "path": [ "shares" ] } }, "response": [] }, { "name": "Upload file", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 201\", () => {", " pm.response.to.have.status(201);", "});", "", "pm.test(\"Response body correct\", () => {", " const responseBody = pm.response.json();", " pm.expect(responseBody).to.have.property(\"id\")", " pm.expect(responseBody.name).to.be.equal(\"test-file.txt\")", " pm.expect(Object.keys(responseBody).length).be.equal(2)", "});" ], "type": "text/javascript" } } ], "protocolProfileBehavior": { "disabledSystemHeaders": { "content-type": true } }, "request": { "method": "POST", "header": [ { "key": "Content-Type", "value": "application/octet-stream", "type": "text" } ], "body": { "mode": "raw", "raw": "data:application/octet-stream;base64,VGhpcyBpcyBhIHRlc3QgZmlsZWQgdXNlZCBmb3IgdXBsb2FkaW5nIGluIHRoZSBzeXN0ZW0gdGVzdC4=" }, "url": { "raw": "{{API_URL}}/shares/:shareId/files?name=test-file.txt&chunkIndex=0&totalChunks=1", "host": [ "{{API_URL}}" ], "path": [ "shares", ":shareId", "files" ], "query": [ { "key": "name", "value": "test-file.txt" }, { "key": "chunkIndex", "value": "0" }, { "key": "totalChunks", "value": "1" } ], "variable": [ { "key": "shareId", "value": "test-share" } ] } }, "response": [] }, { "name": "Upload file 2", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 201\", () => {", " pm.response.to.have.status(201);", "});", "", "pm.test(\"Response body correct\", () => {", " const responseBody = pm.response.json();", " pm.expect(responseBody.name).to.be.equal(\"test-file2.txt\")", " pm.expect(Object.keys(responseBody).length).be.equal(2)", "});" ], "type": "text/javascript" } } ], "protocolProfileBehavior": { "disabledSystemHeaders": { "content-type": true } }, "request": { "method": "POST", "header": [ { "key": "Content-Type", "value": "application/octet-stream", "type": "text" } ], "body": { "mode": "raw", "raw": "data:application/octet-stream;base64,VGhpcyBpcyBhIHRlc3QgZmlsZWQgdXNlZCBmb3IgdXBsb2FkaW5nIGluIHRoZSBzeXN0ZW0gdGVzdC4=" }, "url": { "raw": "{{API_URL}}/shares/:shareId/files?name=test-file2.txt&chunkIndex=0&totalChunks=1", "host": [ "{{API_URL}}" ], "path": [ "shares", ":shareId", "files" ], "query": [ { "key": "name", "value": "test-file2.txt" }, { "key": "chunkIndex", "value": "0" }, { "key": "totalChunks", "value": "1" } ], "variable": [ { "key": "shareId", "value": "test-share" } ] } }, "response": [] }, { "name": "Complete share", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 202\", () => {", " pm.response.to.have.status(202);", "});", "", "pm.test(\"Response body correct\", () => {", " const responseBody = pm.response.json();", " pm.expect(responseBody).to.have.property(\"id\")", " pm.expect(responseBody).to.have.property(\"expiration\")", " pm.expect(Object.keys(responseBody).length).be.equal(3)", "});", "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{API_URL}}/shares/:id/complete", "host": [ "{{API_URL}}" ], "path": [ "shares", ":id", "complete" ], "variable": [ { "key": "id", "value": "test-share" } ] } }, "response": [] } ] }, { "name": "Negative", "item": [ { "name": "Check share id availability - Already exists", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 200\", () => {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response body correct\", () => {", " const responseBody = pm.response.json();", " pm.expect(responseBody.isAvailable).to.be.equal(false)", " pm.expect(Object.keys(responseBody).length).be.equal(1)", "});", "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{API_URL}}/shares/isShareIdAvailable/:id", "host": [ "{{API_URL}}" ], "path": [ "shares", "isShareIdAvailable", ":id" ], "variable": [ { "key": "id", "value": "test-share" } ] } }, "response": [] }, { "name": "Create Share - Already exists", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 400\", () => {", " pm.response.to.have.status(400);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"id\": \"test-share\",\n \"expiration\" : \"2-months\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{API_URL}}/shares", "host": [ "{{API_URL}}" ], "path": [ "shares" ] } }, "response": [] }, { "name": "Create Share - Id less than 3 chars", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 400\", () => {", " pm.response.to.have.status(400);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"id\": \"ab\",\n \"expiration\" : \"2-months\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{API_URL}}/shares", "host": [ "{{API_URL}}" ], "path": [ "shares" ] } }, "response": [] }, { "name": "Upload file - Share already completed", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 400\", () => {", " pm.response.to.have.status(400);", "});", "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{API_URL}}/shares/:shareId/files", "host": [ "{{API_URL}}" ], "path": [ "shares", ":shareId", "files" ], "variable": [ { "key": "shareId", "value": "test-share" } ] } }, "response": [] }, { "name": "Upload file - Share not found", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 404\", () => {", " pm.response.to.have.status(404);", "});", "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{API_URL}}/shares/:shareId/files", "host": [ "{{API_URL}}" ], "path": [ "shares", ":shareId", "files" ], "variable": [ { "key": "shareId", "value": "not-found" } ] } }, "response": [] }, { "name": "Complete share - Not found", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 404\", () => {", " pm.response.to.have.status(404);", "});", "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{API_URL}}/shares/:id/complete", "host": [ "{{API_URL}}" ], "path": [ "shares", ":id", "complete" ], "variable": [ { "key": "id", "value": "not-found" } ] } }, "response": [] }, { "name": "Complete share - Already completed", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 400\", () => {", " pm.response.to.have.status(400);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{API_URL}}/shares/:id/complete", "host": [ "{{API_URL}}" ], "path": [ "shares", ":id", "complete" ], "variable": [ { "key": "id", "value": "test-share" } ] } }, "response": [] } ] } ] }, { "name": "Get Share", "item": [ { "name": "Positive", "item": [ { "name": "Get share token", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 200\", () => {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response body correct\", () => {", " const responseBody = pm.response.json();", " pm.expect(responseBody).to.have.property(\"token\")", " pm.expect(Object.keys(responseBody).length).be.equal(1)", "});", "", "pm.collectionVariables.set(\"COOKIES\", `${pm.collectionVariables.get(\"COOKIES\")};${pm.response.headers.get(\"Set-Cookie\")}`)", "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"password\" : \"share-password\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{API_URL}}/shares/:shareId/token", "host": [ "{{API_URL}}" ], "path": [ "shares", ":shareId", "token" ], "variable": [ { "key": "shareId", "value": "test-share" } ] } }, "response": [] }, { "name": "Get share", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 200\", () => {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response contains 2 files\", () => {", " const responseBody = pm.response.json();", " pm.expect(responseBody.files.length).be.equal(2)", "});", "", "pm.collectionVariables.set(\"fileId\", pm.response.json().files[0].id)" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{API_URL}}/shares/:shareId", "host": [ "{{API_URL}}" ], "path": [ "shares", ":shareId" ], "variable": [ { "key": "shareId", "value": "test-share" } ] } }, "response": [] }, { "name": "Get File", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 200\", () => {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{API_URL}}/shares/:shareId/files/{{fileId}}", "host": [ "{{API_URL}}" ], "path": [ "shares", ":shareId", "files", "{{fileId}}" ], "variable": [ { "key": "shareId", "value": "test-share" } ] } }, "response": [] }, { "name": "Get Zip", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 200\", () => {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "protocolProfileBehavior": { "disableBodyPruning": true }, "request": { "method": "GET", "header": [], "url": { "raw": "{{API_URL}}/shares/:shareId/files/zip", "host": [ "{{API_URL}}" ], "path": [ "shares", ":shareId", "files", "zip" ], "variable": [ { "key": "shareId", "value": "test-share" } ] } }, "response": [] } ] }, { "name": "Negative", "item": [ { "name": "Get share token - Wrong password", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 403\", () => {", " pm.response.to.have.status(403);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"password\" : \"wrong-password\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{API_URL}}/shares/:shareId/token", "host": [ "{{API_URL}}" ], "path": [ "shares", ":shareId", "token" ], "variable": [ { "key": "shareId", "value": "test-share" } ] } }, "response": [] }, { "name": "Get share token - Visitor limit exceeded", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 403\", () => {", " pm.response.to.have.status(403);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"password\" : \"share-password\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{API_URL}}/shares/:shareId/token", "host": [ "{{API_URL}}" ], "path": [ "shares", ":shareId", "token" ], "variable": [ { "key": "shareId", "value": "test-share" } ] } }, "response": [] } ] } ] } ], "event": [ { "listen": "prerequest", "script": { "type": "text/javascript", "exec": [ "pm.request.addHeader(\"Cookie\", pm.collectionVariables.get(\"COOKIES\"))" ] } }, { "listen": "test", "script": { "type": "text/javascript", "exec": [ "" ] } } ], "variable": [ { "key": "API_URL", "value": "http://localhost:8080/api", "type": "string" } ] }