{"info":{"_postman_id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","name":"bep2-project","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"description":"<html><head></head><body></body></html>","owner":"229781","collectionId":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","publishedId":"TVeiCAVt","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2020-11-06T13:30:47.000Z"},"item":[{"name":"done","item":[{"name":"login","item":[{"name":"Login","event":[{"listen":"test","script":{"id":"974ff9aa-b57e-45f4-9c91-a15fa1f7d69f","exec":["pm.test(\"Status test\", function () {","    pm.response.to.have.status(200);","});","if (pm.response.code === 200) {","    const authHeader = pm.response.headers.get(\"Authorization\");","    const token = authHeader.substring(7);","    pm.collectionVariables.set(\"adminAuthToken\", token);","    pm.collectionVariables.set(\"authToken\", token);","}","pm.sendRequest({","    url: pm.collectionVariables.get(\"url\")+\"/test\",","    method:\"GET\",","    header: {","        \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"adminAuthToken\")","    }","},(err,response)=>{","    pm.test(\"zou ingelogd moeten zijn als employee\",()=>pm.expect(response.code).to.be.equals(200))","});","","pm.sendRequest({","    url: pm.collectionVariables.get(\"url\")+\"/register/user@example.com\",","    method:\"DELETE\",","    header: {","        \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"adminAuthToken\")","    }","},(err,response)=>{","    //hier geen tests","    pm.sendRequest({","        url: pm.collectionVariables.get(\"url\")+\"/register\",","        method:\"POST\",","        body: {","            mode: 'raw',","            raw: JSON.stringify({","                \"firstName\": \"Jan\",","                \"lastName\": \"Piet\",","                \"birthday\": \"2020-06-09\",","                \"email\": \"user@example.com\",","                \"phone\": \"1234567890\",","                \"nationality\": \"Netherlands\",","                \"password\": \"password\"","            })","        },","        header: {","            'Content-Type': 'application/json'","        }","    },(err,response)=>{","         pm.test(\"register zou 200 moeten geven.\",()=>pm.expect(response.code).to.be.equals(200))","         pm.sendRequest({","            url: pm.collectionVariables.get(\"url\")+\"/login\",","            method:\"POST\",","            body: {","                mode: 'raw',","                raw: JSON.stringify({","                    \"email\": \"user@example.com\",","                    \"password\": \"password\"","                })","            },","            header: {","                'Content-Type': 'application/json'","            }","        },(err,response)=>{","            pm.test(\"login as customer zou 200 moeten geven.\",()=>pm.expect(response.code).to.be.equals(200))","            if (response.code === 200) {","                const authHeader = response.headers.get(\"Authorization\");","                const token = authHeader.substring(7);","                pm.collectionVariables.set(\"authToken\", token);","            }","            pm.sendRequest({","                url: pm.collectionVariables.get(\"url\")+\"/test\",","                method:\"GET\",","                header: {","                    \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"authToken\")","                }","            },(err,response)=>{","                pm.test(\"zou niet ingelogd moeten zijn als employee\",()=>pm.expect(response.code).to.be.equals(403))","                pm.sendRequest({","                    url: pm.collectionVariables.get(\"url\")+\"/employee/setEmployee\",","                    method:\"POST\",","                    body: {","                        mode: 'raw',","                        raw: JSON.stringify({","                            \"email\": \"user@example.com\"","                        })","                    },","                    header: {","                        \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"adminAuthToken\"),","                        'Content-Type': 'application/json'","                    }","                },(err,response)=>{","                    pm.test(\"set employee status 200\",()=>pm.expect(response.code).to.be.equals(200))","                        pm.sendRequest({","                        url: pm.collectionVariables.get(\"url\")+\"/login\",","                        method:\"POST\",","                        body: {","                            mode: 'raw',","                            raw: JSON.stringify({","                                \"email\": \"user@example.com\",","                                \"password\": \"password\"","                            })","                        },","                        header: {","                            'Content-Type': 'application/json'","                        }","                    },(err,response)=>{","                        pm.test(\"login as employee zou 200 moeten geven.\",()=>pm.expect(response.code).to.be.equals(200))","                        if (response.code === 200) {","                            const authHeader = response.headers.get(\"Authorization\");","                            const token = authHeader.substring(7);","                            pm.collectionVariables.set(\"authToken\", token);","                        }","                        pm.sendRequest({","                            url: pm.collectionVariables.get(\"url\")+\"/test\",","                            method:\"GET\",","                            header: {","                                \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"authToken\")","                            }","                        },(err,response)=>{","                            pm.test(\"zou ingelogd moeten zijn als employee\",()=>pm.expect(response.code).to.be.equals(200))","                        })","                    })","                });","            });","        })","    })","});","","pm.sendRequest({","    url: pm.collectionVariables.get(\"url\")+\"/register/user2@example.com\",","    method:\"DELETE\",","    header: {","        \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"adminAuthToken\")","    }","},(err,response)=>{","    pm.sendRequest({","        url: pm.collectionVariables.get(\"url\")+\"/register\",","        method:\"POST\",","        body: {","            mode: 'raw',","            raw: JSON.stringify({","                \"firstName\": \"Jan2\",","                \"lastName\": \"Piet2\",","                \"birthday\": \"2018-06-09\",","                \"email\": \"user2@example.com\",","                \"phone\": \"1234567890\",","                \"nationality\": \"Netherlands\",","                \"password\": \"password\"","            })","        },","        header: {","            'Content-Type': 'application/json'","        }","    },(err,response)=>{","            pm.test(\"register zou 200 moeten geven.\",()=>pm.expect(response.code).to.be.equals(200))","            pm.sendRequest({","            url: pm.collectionVariables.get(\"url\")+\"/login\",","            method:\"POST\",","            body: {","                mode: 'raw',","                raw: JSON.stringify({","                    \"email\": \"user2@example.com\",","                    \"password\": \"password\"","                })","            },","            header: {","                'Content-Type': 'application/json'","            }","        },(err,response)=>{","            pm.test(\"login as customer zou 200 moeten geven.\",()=>pm.expect(response.code).to.be.equals(200))","            if (response.code === 200) {","                const authHeader = response.headers.get(\"Authorization\");","                const token = authHeader.substring(7);","                pm.collectionVariables.set(\"customerToken\", token);","            }","            pm.sendRequest({","                url: pm.collectionVariables.get(\"url\")+\"/test\",","                method:\"GET\",","                header: {","                    \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"customerToken\")","                }","            },(err,response)=>{","                pm.test(\"zou niet ingelogd moeten zijn als employee\",()=>pm.expect(response.code).to.be.equals(403))","            })","        })","    })","})"],"type":"text/javascript"}}],"id":"869687f4-6abd-49b9-8a45-22203ddbdddc","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"email\": \"admin@example.com\",\n    \"password\": \"admin\"\n}","options":{"raw":{"language":"json"}}},"url":"https://bep2-ruben.herokuapp.com/login","urlObject":{"path":["login"],"host":["https://bep2-ruben.herokuapp.com"],"query":[],"variable":[]}},"response":[],"_postman_id":"869687f4-6abd-49b9-8a45-22203ddbdddc"}],"id":"311b867b-1d19-4776-8063-32aa744cbe82","_postman_id":"311b867b-1d19-4776-8063-32aa744cbe82","description":"","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":true,"source":{"_postman_id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","name":"bep2-project","type":"collection"}}},{"name":"customer","item":[{"name":"create Flight Not allowed","event":[{"listen":"test","script":{"id":"af0d6f5e-e20c-4896-924a-dc6de30861df","exec":["pm.test(\"Status test\", function () {","    pm.response.to.have.status(403);","});"],"type":"text/javascript"}}],"id":"ac939499-073c-4cae-b7de-1e40b04a36b6","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"departureTime\":\"2020-10-19T03:05:00\",\n    \"arrivalTime\":\"2020-10-19T06:30:00\",\n    \"route\":3,\n    \"plane\":\"PH-HSJ\"\n}","options":{"raw":{"language":"json"}}},"url":"https://bep2-ruben.herokuapp.com/flight","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":true,"source":{"_postman_id":"c27baf02-5e93-4854-b7f2-fbe920225ad8","id":"c27baf02-5e93-4854-b7f2-fbe920225ad8","name":"customer","type":"folder"}},"urlObject":{"path":["flight"],"host":["https://bep2-ruben.herokuapp.com"],"query":[],"variable":[]}},"response":[],"_postman_id":"ac939499-073c-4cae-b7de-1e40b04a36b6"},{"name":"Get all available flights as customer","event":[{"listen":"test","script":{"id":"e7fd1d9c-7e34-47ed-bf6e-eec1d1dc97f9","exec":["pm.test(\"Status test\", function () {","    pm.response.to.have.status(200);","});"],"type":"text/javascript"}}],"id":"dcdd4f7d-399b-4fa2-aa51-fcfca890f1c2","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"https://bep2-ruben.herokuapp.com/customer/findflightbytime","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":true,"source":{"_postman_id":"c27baf02-5e93-4854-b7f2-fbe920225ad8","id":"c27baf02-5e93-4854-b7f2-fbe920225ad8","name":"customer","type":"folder"}},"urlObject":{"path":["customer","findflightbytime"],"host":["https://bep2-ruben.herokuapp.com"],"query":[],"variable":[]}},"response":[],"_postman_id":"dcdd4f7d-399b-4fa2-aa51-fcfca890f1c2"},{"name":"create Booking","event":[{"listen":"test","script":{"id":"5f318bb9-1597-4090-9f95-903b96baa7cc","exec":["function jwt_decode(jwt) {","    var parts = jwt.split('.'); // header, payload, signature","    return JSON.parse(atob(parts[1]));","} //https://github.com/postmanlabs/postman-app-support/issues/1044#issuecomment-230813374","","","pm.test(\"Status test\", function () {","    pm.response.to.have.status(201);","});","pm.collectionVariables.set(\"bookingId\", pm.response.json().id);","pm.sendRequest({","    url: pm.collectionVariables.get(\"url\")+\"/booking/\"+pm.collectionVariables.get(\"bookingId\"),","    method:\"GET\",","    header: {","        \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"adminAuthToken\")","    }","},(err,response)=>{","    pm.test(\"getBooking zou 200 moeten geven\",()=>pm.expect(response.code).to.be.equals(200))","    pm.test(\"Booking is correct opgeslagen\",()=>{","        var responseData=response.json();","        var requestData=JSON.parse(request.data);","        delete responseData.persons[0].id","        pm.expect(responseData._links.customer.href.split('/').pop()).to.be.equals(jwt_decode(pm.collectionVariables.get(\"customerToken\")).sub);","        pm.expect(responseData.travelClassFlight.id).to.be.equals(requestData.travelClassFlightID);","        pm.expect(responseData.confirmed).to.be.equals(false);","        pm.sendRequest({","            url: pm.collectionVariables.get(\"url\")+\"/booking/confirm/\"+pm.collectionVariables.get(\"bookingId\"),","            method:\"GET\"","        },(err,response)=>{","            pm.test(\"booking confirm zou 200 moeten geven\",()=>pm.expect(response.code).to.be.equals(200))","            pm.test(\"Booking is confirmed\",()=>{","                var responseData=response.json();","                pm.expect(responseData.confirmed).to.be.equals(true);","                ","            })","        });","    })","});","","// [TEST] Maak een booking voor een vlucht die niet genoeg seats heeft - expect 400 bad request","pm.sendRequest({","    url: pm.collectionVariables.get(\"url\")+\"/booking\",","    method:\"POST\",","    header: {","        \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"customerToken\"),","        'Content-Type': 'application/json'","    },","    body: {","            mode: 'raw',","            raw: JSON.stringify({","                \"travelClassFlightID\": 1, // Deze flight heeft 0 available seats","                    // De customer die de boeking doet word ook mee gestuurd","                    \"personDTOS\": [{","                    \"firstName\": \"Bert\",","                    \"lastName\": \"Jaap\",","                    \"birthday\": \"2013-07-12\",","                    \"email\": \"thisisatest@example.com\",","                    \"phone\": \"062252532\",","                    \"nationality\": \"Dutch\"","                }]","            })","        },","},(err,response)=>{","    pm.test(\"POST Booking met niet genoeg seats geeft 400\",()=>pm.expect(response.code).to.be.equals(400))","});"],"type":"text/javascript"}}],"id":"5c8760c6-51e9-4e54-9569-ed3ecb2f2fce","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{    \r\n    \"travelClassFlightID\": 23,\r\n    \"personDTOS\": [{\r\n        \"firstName\": \"Bert\",\r\n        \"lastName\": \"Jaap\",\r\n        \"birthday\": \"2013-07-12\",\r\n        \"email\": \"thisisatest@example.com\",\r\n        \"phone\": \"062252532\",\r\n        \"nationality\": \"Netherlands\"\r\n    }]\r\n}","options":{"raw":{"language":"json"}}},"url":"https://bep2-ruben.herokuapp.com/booking","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":true,"source":{"_postman_id":"c27baf02-5e93-4854-b7f2-fbe920225ad8","id":"c27baf02-5e93-4854-b7f2-fbe920225ad8","name":"customer","type":"folder"}},"urlObject":{"path":["booking"],"host":["https://bep2-ruben.herokuapp.com"],"query":[],"variable":[]}},"response":[],"_postman_id":"5c8760c6-51e9-4e54-9569-ed3ecb2f2fce"},{"name":"findFlight","event":[{"listen":"test","script":{"id":"01e32162-9c00-4289-a29d-05bdb0e3ca41","exec":["pm.test(\"Status test\", function () {","    pm.response.to.have.status(200);","});","pm.test(\"correct flight\",function () {","    var responseData=pm.response.json();","    pm.expect(responseData._embedded.flightList.length).to.be.equals(1);","    pm.expect(responseData._embedded.flightList[0].id).to.be.equals(5);","})","pm.sendRequest({","    url: pm.collectionVariables.get(\"url\")+\"/customer/findflight?departureCode=NBE&arrivalCode=VCE&departureDate=2020-05-11\",","    method:\"GET\",","    header: {","        \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"customerToken\")","    }","},(err,response)=>{","    responseData=response.json();","    pm.test(\"(UNHAPPY) no flightroute response code.\",()=>pm.expect(response.code).to.be.equals(200))","    pm.test(\"(UNHAPPY) no flightroute response data.\",()=>pm.expect(responseData._embedded).to.be.equals(undefined));","});","pm.sendRequest({","    url: pm.collectionVariables.get(\"url\")+\"/customer/findflight?departureCode=KGF&arrivalCode=VCE&departureDate=2020-05-15\",","    method:\"GET\",","    header: {","        \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"customerToken\")","    }","},(err,response)=>{","    responseData=response.json();","    pm.test(\"(UNHAPPY) no flight on date response code.\",()=>pm.expect(response.code).to.be.equals(200))","    pm.test(\"(UNHAPPY) no flight on date response data.\",()=>pm.expect(responseData._embedded).to.be.equals(undefined));","});","pm.sendRequest({","    url: pm.collectionVariables.get(\"url\")+\"/customer/findflight?departureCode=TSE&arrivalCode=AKT&departureDate=2020-04-11\",","    method:\"GET\",","    header: {","        \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"customerToken\")","    }","},(err,response)=>{","    responseData=response.json();","    pm.test(\"(UNHAPPY) full flight response code.\",()=>pm.expect(response.code).to.be.equals(200))","    pm.test(\"(UNHAPPY) full flight data.\",()=>pm.expect(responseData._embedded).to.be.equals(undefined));","});"],"type":"text/javascript"}}],"id":"b5102063-e751-4f63-8ae5-69d38834b2a4","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"https://bep2-ruben.herokuapp.com/customer/findflight?departureCode=KGF&arrivalCode=VCE&departureDate=2020-05-11","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":true,"source":{"_postman_id":"c27baf02-5e93-4854-b7f2-fbe920225ad8","id":"c27baf02-5e93-4854-b7f2-fbe920225ad8","name":"customer","type":"folder"}},"urlObject":{"path":["customer","findflight"],"host":["https://bep2-ruben.herokuapp.com"],"query":[{"key":"departureCode","value":"KGF"},{"key":"arrivalCode","value":"VCE"},{"key":"departureDate","value":"2020-05-11"}],"variable":[]}},"response":[],"_postman_id":"b5102063-e751-4f63-8ae5-69d38834b2a4"}],"id":"c27baf02-5e93-4854-b7f2-fbe920225ad8","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":false},"event":[{"listen":"prerequest","script":{"id":"b93a71c0-8017-4ec9-a4ca-03d3f77de5b1","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"f73c70b9-fda4-4f58-9e07-09db9aef057c","type":"text/javascript","exec":[""]}}],"_postman_id":"c27baf02-5e93-4854-b7f2-fbe920225ad8","description":""},{"name":"employee","item":[{"name":"Flight","event":[{"listen":"test","script":{"id":"e122c967-305d-4a2f-8134-acb2531d25d8","exec":["pm.test(\"Status test\", function () {","    pm.response.to.have.status(201);","});","pm.collectionVariables.set(\"flightId\", pm.response.json().id);","pm.sendRequest({","    url: pm.collectionVariables.get(\"url\")+\"/flight/\"+pm.collectionVariables.get(\"flightId\"),","    method:\"GET\",","    header: {","        \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"authToken\")","    }","},(err,response)=>{","    pm.test(\"GetFlight zou 200 moeten geven.\",()=>pm.expect(response.code).to.be.equals(200))","    pm.test(\"Flight is correct opgeslagen.\",()=>{","        var responseData=response.json();","        var requestData=JSON.parse(request.data);","        pm.expect(responseData.departureTime).to.be.equals(requestData.departureTime);","        pm.expect(responseData.arrivalTime).to.be.equals(requestData.arrivalTime);","    })","});","newdata={","    \"arrivalTime\":\"2000-10-19T03:05:00\",","    \"departureTime\":\"2000-10-19T06:30:00\"","}","pm.sendRequest({","    url: pm.collectionVariables.get(\"url\")+\"/flight/\"+pm.collectionVariables.get(\"flightId\"),","    method:\"PUT\",","    body: {","        mode: 'raw',","        raw: JSON.stringify(newdata)","    },","    header: {","        'Content-Type': 'application/json',","        \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"authToken\")","    }","},(err,response)=>{","    pm.test(\"PUTflight zou 200 moeten geven.\",()=>pm.expect(response.code).to.be.equals(200))","    pm.test(\"Flight is correct geupdated.\",()=>{","        var responseData=response.json();","        pm.expect(responseData.departureTime).to.be.equals(newdata.departureTime);","        pm.expect(responseData.arrivalTime).to.be.equals(newdata.arrivalTime);","    })","    pm.sendRequest({","        url: pm.collectionVariables.get(\"url\")+\"/flight/\"+pm.collectionVariables.get(\"flightId\"),","        method:\"DELETE\",","        header: {","            \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"authToken\")","        }","    },(err,response)=>{","        pm.test(\"deleteFlight zou 200 moeten geven.\",()=>pm.expect(response.code).to.be.equals(200))","        pm.sendRequest({","            url: pm.collectionVariables.get(\"url\")+\"/flight/\"+pm.collectionVariables.get(\"flightId\"),","            method:\"GET\",","            header: {","                \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"authToken\")","            }","        },(err,response)=>{","            pm.test(\"Flight zou nu weg moeten zijn.\",()=>pm.expect(response.code).to.be.equals(404)) ","        });","    });","});","","// [TEST] Flight maken met ongeldige Route id - expect 404 Route not found","pm.sendRequest({","    url: pm.collectionVariables.get(\"url\")+\"/flight\",","    method:\"POST\",","    header: {","        \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"authToken\"),","        'Content-Type': 'application/json'","    },","    body: {","            mode: 'raw',","            raw: JSON.stringify({","                \"departureTime\":\"2020-10-19T03:05:00\",","                \"arrivalTime\":\"2020-10-19T06:30:00\",","                \"route\":999, // Foute route code","                \"plane\":\"PH-HSJ\"","            })","        },","},(err,response)=>{","    pm.test(\"POST Flight met foutieve Route geeft 404\",()=>pm.expect(response.code).to.be.equals(404))","});","","// [TEST] Flight maken met ongeldige Plane id - expect 404 Plane not found","pm.sendRequest({","    url: pm.collectionVariables.get(\"url\")+\"/flight\",","    method:\"POST\",","    header: {","        \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"authToken\"),","        'Content-Type': 'application/json'","    },","    body: {","            mode: 'raw',","            raw: JSON.stringify({","                \"departureTime\":\"2020-11-19T03:05:00\",","                \"arrivalTime\":\"2020-11-19T06:30:00\",","                \"route\":4,","                \"plane\":\"KB-gSo\" // Foute plane code","            })","        },","},(err,response)=>{","    pm.test(\"POST Flight met foutieve Plane geeft 404\",()=>pm.expect(response.code).to.be.equals(404))","});"],"type":"text/javascript"}}],"id":"b5900428-46d2-475a-9181-97bc61e25a1e","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"departureTime\":\"2020-10-19T03:05:00\",\n    \"arrivalTime\":\"2020-10-19T06:30:00\",\n    \"route\":3,\n    \"plane\":\"PH-HSJ\"\n}","options":{"raw":{"language":"json"}}},"url":"https://bep2-ruben.herokuapp.com/flight","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":true,"source":{"_postman_id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","name":"bep2-project","type":"collection"}},"urlObject":{"path":["flight"],"host":["https://bep2-ruben.herokuapp.com"],"query":[],"variable":[]}},"response":[],"_postman_id":"b5900428-46d2-475a-9181-97bc61e25a1e"},{"name":"getFlight unhappy","event":[{"listen":"test","script":{"id":"f373b067-6eb8-4f22-9e89-ae0f25e05a34","exec":["pm.test(\"Status test\", function () {","    pm.response.to.have.status(404);","});"],"type":"text/javascript"}}],"id":"844544a2-dbe3-458b-8b78-c59aa4669647","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"https://bep2-ruben.herokuapp.com/flight/999","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":true,"source":{"_postman_id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","name":"bep2-project","type":"collection"}},"urlObject":{"path":["flight","999"],"host":["https://bep2-ruben.herokuapp.com"],"query":[],"variable":[]}},"response":[],"_postman_id":"844544a2-dbe3-458b-8b78-c59aa4669647"},{"name":"Plane","event":[{"listen":"test","script":{"id":"cac7c430-f79f-435c-85c5-f083b27ac7e8","exec":["pm.test(\"Status test\", function () {","    pm.response.to.have.status(201);","});","pm.collectionVariables.set(\"planeId\", pm.response.json().code);","pm.sendRequest({","    url: pm.collectionVariables.get(\"url\")+\"/plane/\"+pm.collectionVariables.get(\"planeId\"),","    method:\"GET\",","    header: {","        \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"authToken\")","    }","},(err,response)=>{","    pm.test(\"getPlane zou 200 moeten geven.\",()=>pm.expect(response.code).to.be.equals(200))","    pm.test(\"Plane is correct opgeslagen.\",()=>{","        var responseData=response.json();","        var requestData=JSON.parse(request.data);","        pm.expect(responseData.type.id).to.be.equals(requestData.type);","    })","});","newdata={","    \"type\":3","}","pm.sendRequest({","    url: pm.collectionVariables.get(\"url\")+\"/plane/\"+pm.collectionVariables.get(\"planeId\"),","    method:\"PUT\",","    body: {","        mode: 'raw',","        raw: JSON.stringify(newdata)","    },","    header: {","        'Content-Type': 'application/json',","        \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"authToken\")","    }","},(err,response)=>{","    pm.test(\"PUTplane zou 200 moeten geven.\",()=>pm.expect(response.code).to.be.equals(200))","    pm.test(\"Plane is correct geupdated.\",()=>{","        var responseData=response.json();","        pm.expect(responseData.type.id).to.be.equals(newdata.type);","    })","    pm.sendRequest({","        url: pm.collectionVariables.get(\"url\")+\"/plane/\"+pm.collectionVariables.get(\"planeId\"),","        method:\"DELETE\",","        header: {","            \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"authToken\")","        }","    },(err,response)=>{","        pm.test(\"deletePlane zou 200 moeten geven.\",()=>pm.expect(response.code).to.be.equals(200))","        pm.sendRequest({","            url: pm.collectionVariables.get(\"url\")+\"/plane/\"+pm.collectionVariables.get(\"planeId\"),","            method:\"GET\",","            header: {","                \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"authToken\")","            }","        },(err,response)=>{","            pm.test(\"Plane zou nu weg moeten zijn.\",()=>pm.expect(response.code).to.be.equals(404)) ","        });","    });","    ","});"],"type":"text/javascript"}}],"id":"fa9affe3-b471-4c0b-9905-3cc82358459f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"code\":\"boing\",\n    \"type\":2\n}","options":{"raw":{"language":"json"}}},"url":"https://bep2-ruben.herokuapp.com/plane","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":true,"source":{"_postman_id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","name":"bep2-project","type":"collection"}},"urlObject":{"path":["plane"],"host":["https://bep2-ruben.herokuapp.com"],"query":[],"variable":[]}},"response":[],"_postman_id":"fa9affe3-b471-4c0b-9905-3cc82358459f"},{"name":"get all planes","event":[{"listen":"test","script":{"id":"55cd93e4-75b6-407b-8ec1-f7d574d9679f","exec":["pm.test(\"Status test\", function () {","    pm.response.to.have.status(200);","});"],"type":"text/javascript"}}],"id":"ba950f8a-83c6-4070-babe-f17e464f2ac4","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"https://bep2-ruben.herokuapp.com/plane/all","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":true,"source":{"_postman_id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","name":"bep2-project","type":"collection"}},"urlObject":{"path":["plane","all"],"host":["https://bep2-ruben.herokuapp.com"],"query":[],"variable":[]}},"response":[],"_postman_id":"ba950f8a-83c6-4070-babe-f17e464f2ac4"},{"name":"getPlane unhappy","event":[{"listen":"test","script":{"id":"8390cb34-83f8-4b58-b1fc-3a66f18cd9fe","exec":["pm.test(\"Status test\", function () {","    pm.response.to.have.status(404);","});"],"type":"text/javascript"}}],"id":"ae7acbfc-4ed6-4cc6-939e-6d6aa44b4186","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"https://bep2-ruben.herokuapp.com/flight/999","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":true,"source":{"_postman_id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","name":"bep2-project","type":"collection"}},"urlObject":{"path":["flight","999"],"host":["https://bep2-ruben.herokuapp.com"],"query":[],"variable":[]}},"response":[],"_postman_id":"ae7acbfc-4ed6-4cc6-939e-6d6aa44b4186"},{"name":"Airport","event":[{"listen":"test","script":{"id":"3d975a06-ae7b-49bf-8d0f-2895d36932f7","exec":["pm.test(\"Status test\", function () {","    pm.response.to.have.status(201);","});","pm.collectionVariables.set(\"airportId\", pm.response.json().code);","pm.sendRequest({","    url: pm.collectionVariables.get(\"url\")+\"/airport/\"+pm.collectionVariables.get(\"airportId\"),","    method:\"GET\",","    header: {","        \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"authToken\")","    }","},(err,response)=>{","    pm.test(\"getAirport zou 200 moeten geven.\",()=>pm.expect(response.code).to.be.equals(200))","    pm.test(\"Airport is correct opgeslagen.\",()=>{","        var responseData=response.json();","        var requestData=JSON.parse(request.data);","\t\tpm.expect(responseData.code).to.be.equals(requestData.code);","        pm.expect(responseData.name).to.be.equals(requestData.name);","        pm.expect(responseData.lat).to.be.equals(requestData.lat);","        pm.expect(responseData.lng).to.be.equals(requestData.lng);","        pm.expect(responseData.country).to.be.equals(requestData.country);","        pm.expect(responseData.place).to.be.equals(requestData.place);","    })","});","newdata={","    \"code\":\"AAA\",","    \"name\":\"Schiphol\",","    \"lat\":35.74857,","    \"lng\":83.98690,","    \"country\":\"Netherlands\",","    \"place\":\"Amsterdam\"","","}","pm.sendRequest({","    url: pm.collectionVariables.get(\"url\")+\"/airport/\"+pm.collectionVariables.get(\"airportId\"),","    method:\"PUT\",","    body: {","        mode: 'raw',","        raw: JSON.stringify(newdata)","    },","    header: {","        'Content-Type': 'application/json',","        \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"authToken\")","    }","},(err,response)=>{","    pm.test(\"PUTairport zou 200 moeten geven.\",()=>pm.expect(response.code).to.be.equals(200))","    pm.test(\"Airport is correct geupdated.\",()=>{","        var responseData=response.json();","\t\tpm.expect(responseData.code).to.be.equals(newdata.code);","        pm.expect(responseData.name).to.be.equals(newdata.name);","        pm.expect(responseData.lat).to.be.equals(newdata.lat);","        pm.expect(responseData.lng).to.be.equals(newdata.lng);","        pm.expect(responseData.country).to.be.equals(newdata.country);","        pm.expect(responseData.place).to.be.equals(newdata.place);","    })","    pm.sendRequest({","        url: pm.collectionVariables.get(\"url\")+\"/airport/\"+pm.collectionVariables.get(\"airportId\"),","        method:\"DELETE\",","        header: {","            \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"authToken\")","        }","    },(err,response)=>{","        pm.test(\"deleteAirport zou 200 moeten geven.\",()=>pm.expect(response.code).to.be.equals(200))","        pm.sendRequest({","            url: pm.collectionVariables.get(\"url\")+\"/airport/\"+pm.collectionVariables.get(\"airportId\"),","            method:\"GET\",","            header: {","                \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"authToken\")","            }","        },(err,response)=>{","            pm.test(\"Airport zou nu weg moeten zijn.\",()=>pm.expect(response.code).to.be.equals(404)) ","        });","    });","    ","});"],"type":"text/javascript"}}],"id":"ac987299-0167-4ed0-8fb7-77e1876f2ffe","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"code\":\"AAA\",\n    \"name\":\"Schiphol\",\n    \"lat\":30.49,\n    \"lng\":40.28,\n    \"country\":\"Netherlands\",\n    \"place\":\"Amsterdam\"\n}","options":{"raw":{"language":"json"}}},"url":"https://bep2-ruben.herokuapp.com/airport","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":true,"source":{"_postman_id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","name":"bep2-project","type":"collection"}},"urlObject":{"path":["airport"],"host":["https://bep2-ruben.herokuapp.com"],"query":[],"variable":[]}},"response":[],"_postman_id":"ac987299-0167-4ed0-8fb7-77e1876f2ffe"},{"name":"create FlightRoute","event":[{"listen":"test","script":{"id":"cdac9f7e-c75e-4e5e-b29d-c7bfc5ff16f5","exec":["pm.test(\"Status test\", function () {\r","    pm.response.to.have.status(201);\r","});\r","pm.collectionVariables.set(\"flightrouteID\", pm.response.json().id);\r","pm.sendRequest({\r","    url: pm.collectionVariables.get(\"url\")+\"/flightroute/\"+pm.collectionVariables.get(\"flightrouteID\"),\r","    method:\"GET\",\r","    header: {\r","        \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"authToken\")\r","    }\r","},(err,response)=>{\r","    pm.test(\"getFlightRoute zou 200 moeten geven\",()=>pm.expect(response.code).to.be.equals(200))\r","    pm.test(\"FlightRoute is correct opgeslagen\",()=>{\r","        var responseData=response.json();\r","        var requestData=JSON.parse(request.data);\r","        pm.expect(responseData.distance).to.be.equals(157);\r","    })\r","});"],"type":"text/javascript"}},{"listen":"prerequest","script":{"id":"fac9a07b-de41-4f60-8399-52b62b4d3cd2","exec":[""],"type":"text/javascript"}}],"id":"094d1c44-9aee-40e6-809b-60c7a6d344b8","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"departure\":\"AMS\",\r\n    \"destination\":\"BRU\"\r\n}","options":{"raw":{"language":"json"}}},"url":"https://bep2-ruben.herokuapp.com/flightroute","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":true,"source":{"_postman_id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","name":"bep2-project","type":"collection"}},"urlObject":{"path":["flightroute"],"host":["https://bep2-ruben.herokuapp.com"],"query":[],"variable":[]}},"response":[],"_postman_id":"094d1c44-9aee-40e6-809b-60c7a6d344b8"},{"name":"CreatePlaneType","id":"7ded5335-20ed-42be-b3fb-ead5a59618f4","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"name\":\"PlaneTypeName\",\r\n    \"travelClassDTOs\" : [{\r\n        \"max_seats\" : 100,\r\n        \"name\": \"Travelclass1\",\r\n        \"price_per_km\": 0.30\r\n        },\r\n        {\r\n        \"max_seats\" : 200,\r\n        \"name\": \"Travelclass2\",\r\n        \"price_per_km\": 0.30\r\n    }]\r\n}","options":{"raw":{"language":"json"}}},"url":"https://bep2-ruben.herokuapp.com/planetype","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":true,"source":{"_postman_id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","name":"bep2-project","type":"collection"}},"urlObject":{"path":["planetype"],"host":["https://bep2-ruben.herokuapp.com"],"query":[],"variable":[]}},"response":[],"_postman_id":"7ded5335-20ed-42be-b3fb-ead5a59618f4"},{"name":"cancel Flight","event":[{"listen":"test","script":{"id":"a1150161-a623-43b0-a28b-6f5e8d0b812b","exec":["pm.test(\"flight zou gecanceled moeten zijn\",()=>pm.expect(pm.response.json().canceled).to.be.equals(true))"],"type":"text/javascript"}}],"id":"18a4930f-dfac-490f-8bb5-930e0095b89a","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PATCH","header":[],"url":"https://bep2-ruben.herokuapp.com/flight/29","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":true,"source":{"_postman_id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","name":"bep2-project","type":"collection"}},"urlObject":{"path":["flight","29"],"host":["https://bep2-ruben.herokuapp.com"],"query":[],"variable":[]}},"response":[],"_postman_id":"18a4930f-dfac-490f-8bb5-930e0095b89a"},{"name":"inzien employee","event":[{"listen":"test","script":{"id":"b3c38b8d-c12a-4723-a398-6b565e81a7a1","exec":["pm.test(\"Status test\", function () {","    pm.response.to.have.status(200);","});","pm.test(\"3 employees\",function () {","    var responseData=pm.response.json();","    pm.expect(responseData._embedded.employeeList.length).to.be.equals(3);","});","pm.sendRequest({","    url: pm.collectionVariables.get(\"url\")+\"/register/user2@example.com\",","    method:\"DELETE\",","    header: {","        \"authorization\": \"Bearer \"+pm.collectionVariables.get(\"adminAuthToken\")","    }","},(err,response)=>{","    pm.test(\"verwijderen employee\",()=>pm.expect(response.code).to.be.equals(200));","})"],"type":"text/javascript"}}],"id":"acbf3e64-f49e-4c19-9cdb-4870895e6445","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"https://bep2-ruben.herokuapp.com/employee/all","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":true,"source":{"_postman_id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","name":"bep2-project","type":"collection"}},"urlObject":{"path":["employee","all"],"host":["https://bep2-ruben.herokuapp.com"],"query":[],"variable":[]}},"response":[],"_postman_id":"acbf3e64-f49e-4c19-9cdb-4870895e6445"}],"id":"7f444597-a985-42cc-96e6-f3f68fde742e","_postman_id":"7f444597-a985-42cc-96e6-f3f68fde742e","description":"","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":true,"source":{"_postman_id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","name":"bep2-project","type":"collection"}}},{"name":"log off","event":[{"listen":"test","script":{"id":"1eb7939b-14ec-40c4-a34c-1c09c6077bc0","exec":["pm.collectionVariables.unset(\"authToken\");",""],"type":"text/javascript"}}],"id":"44c226a2-1ba1-4ed8-8da4-358cd8a5fac3","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"https://bep2-ruben.herokuapp.com/logoff","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":true,"source":{"_postman_id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","name":"bep2-project","type":"collection"}},"urlObject":{"path":["logoff"],"host":["https://bep2-ruben.herokuapp.com"],"query":[],"variable":[]}},"response":[],"_postman_id":"44c226a2-1ba1-4ed8-8da4-358cd8a5fac3"}],"id":"1699172c-2667-463d-bf71-5c8fbfac01ad","_postman_id":"1699172c-2667-463d-bf71-5c8fbfac01ad","description":"","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":true,"source":{"_postman_id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","name":"bep2-project","type":"collection"}}},{"name":"WIP","item":[{"name":"customer","item":[],"id":"74fbc9c3-e335-4bab-aeb9-72f42c9e2720","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":false},"_postman_id":"74fbc9c3-e335-4bab-aeb9-72f42c9e2720","description":""}],"id":"29c56668-46ed-4e54-84e1-3287d88c8308","_postman_id":"29c56668-46ed-4e54-84e1-3287d88c8308","description":"","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":true,"source":{"_postman_id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","id":"fd0a91ad-7eeb-4e84-aa23-b272de8a1973","name":"bep2-project","type":"collection"}}}],"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]}},"event":[{"listen":"prerequest","script":{"id":"6dd36e61-a717-487a-b681-11b5912f56ff","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"aaed6334-4bd9-4725-84ed-08e9466a0ab5","type":"text/javascript","exec":[""]}}],"variable":[{"key":"url","value":"https://bep2-ruben.herokuapp.com"},{"key":"adminAuthToken","value":""},{"key":"customerToken","value":""},{"key":"flightId","value":""},{"key":"planeId","value":""},{"key":"airportId","value":""},{"key":"flightrouteID","value":""},{"key":"bookingId","value":""},{"key":"authToken","value":""}]}