diff --git a/Backend/src/models/contact_persons/contact_persons.router.ts b/Backend/src/models/contact_persons/contact_persons.router.ts index bb2d1a0..85c8035 100644 --- a/Backend/src/models/contact_persons/contact_persons.router.ts +++ b/Backend/src/models/contact_persons/contact_persons.router.ts @@ -89,7 +89,7 @@ contactpersonsRouter.post('/', async (req: Request, res: Response) => { const success = await ContactPersonService.createContactEntry(user.user_id, vendor_id, first_name, last_name, gender, email, phone); if (success) { - res.sendStatus(200); + res.sendStatus(201); } else { res.sendStatus(500); } diff --git a/Backend/src/models/pricealarms/pricealarms.router.ts b/Backend/src/models/pricealarms/pricealarms.router.ts index cc42032..fcd4939 100644 --- a/Backend/src/models/pricealarms/pricealarms.router.ts +++ b/Backend/src/models/pricealarms/pricealarms.router.ts @@ -85,11 +85,11 @@ pricealarmsRouter.put('/', async (req: Request, res: Response) => { return; } - // Create price alarm + // Update price alarm const success = await PriceAlarmsService.updatePriceAlarm(alarm_id, user.user_id, defined_price); if (success) { - res.status(201).send(JSON.stringify({success: true})); + res.status(200).send(JSON.stringify({success: true})); return; } else { res.status(500).send(JSON.stringify({success: false})); diff --git a/Backend/src/models/prices/prices.router.ts b/Backend/src/models/prices/prices.router.ts index 047ce1b..6d3d389 100644 --- a/Backend/src/models/prices/prices.router.ts +++ b/Backend/src/models/prices/prices.router.ts @@ -117,7 +117,7 @@ pricesRouter.post('/', async (req: Request, res: Response) => { const success = await PriceService.createPriceEntry(user.user_id, vendor_id, product_id, price_in_cents); if (success) { - res.sendStatus(200); + res.sendStatus(201); } else { res.sendStatus(500); } diff --git a/Backend/src/models/users/users.router.ts b/Backend/src/models/users/users.router.ts index db28a93..fe67f1b 100644 --- a/Backend/src/models/users/users.router.ts +++ b/Backend/src/models/users/users.router.ts @@ -105,7 +105,7 @@ usersRouter.post('/checkSessionValid', async (req: Request, res: Response) => { } // Send the session details back to the user - res.status(201).send(user); + res.status(200).send(user); } catch (e) { console.log('Error handling a request: ' + e.message); res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'})); diff --git a/Crawler/Dockerfile b/Crawler/Dockerfile index 1fa49c2..00da0cc 100644 --- a/Crawler/Dockerfile +++ b/Crawler/Dockerfile @@ -1,10 +1,10 @@ # Base image -FROM python +FROM python:3.9.5-buster # Create directories and copy files RUN echo 'Creating directory and copying files' RUN mkdir /crawler -ADD . /crawler +COPY . /crawler WORKDIR /crawler # Install dependencies diff --git a/Frontend/src/app/models/category.ts b/Frontend/src/app/models/category.ts new file mode 100644 index 0000000..a909167 --- /dev/null +++ b/Frontend/src/app/models/category.ts @@ -0,0 +1,4 @@ +export interface Category { + category_id: number; + name: string; +} diff --git a/Frontend/src/app/models/contactperson.ts b/Frontend/src/app/models/contactperson.ts new file mode 100644 index 0000000..51a603b --- /dev/null +++ b/Frontend/src/app/models/contactperson.ts @@ -0,0 +1,9 @@ +export interface ContactPerson { + contact_person_id: number; + first_name: string; + last_name: string; + gender: string; + email: string; + phone: string; + vendor_id: number; +} diff --git a/Frontend/src/app/models/crawlingstatus.ts b/Frontend/src/app/models/crawlingstatus.ts new file mode 100644 index 0000000..c54d914 --- /dev/null +++ b/Frontend/src/app/models/crawlingstatus.ts @@ -0,0 +1,7 @@ +export interface CrawlingStatus { + process_id: number; + started_timestamp: Date; + combinations_to_crawl: number; + successful_crawls: number; + failed_crawls: number; +} diff --git a/Frontend/src/app/models/manufacturer.ts b/Frontend/src/app/models/manufacturer.ts new file mode 100644 index 0000000..08e8ea8 --- /dev/null +++ b/Frontend/src/app/models/manufacturer.ts @@ -0,0 +1,4 @@ +export interface Manufacturer { + manufacturer_id: number; + name: string; +} diff --git a/Frontend/src/app/services/api.service.ts b/Frontend/src/app/services/api.service.ts index b050996..8d06a81 100644 --- a/Frontend/src/app/services/api.service.ts +++ b/Frontend/src/app/services/api.service.ts @@ -7,6 +7,10 @@ import {Observable, of} from 'rxjs'; import {Vendor} from '../models/vendor'; import {PriceAlarm} from '../models/pricealarm'; import {FavoriteShop} from '../models/favoriteshop'; +import {ContactPerson} from '../models/contactperson'; +import {Category} from '../models/category'; +import {Manufacturer} from '../models/manufacturer'; +import {CrawlingStatus} from '../models/crawlingstatus'; @Injectable({ providedIn: 'root' @@ -381,4 +385,216 @@ export class ApiService { process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`); } } + + + /* ______ __ __ ____ + / ____/___ ____ / /_____ ______/ /_ / __ \___ ______________ ____ _____ + / / / __ \/ __ \/ __/ __ `/ ___/ __/ / /_/ / _ \/ ___/ ___/ __ \/ __ \/ ___/ + / /___/ /_/ / / / / /_/ /_/ / /__/ /_ / ____/ __/ / (__ ) /_/ / / / (__ ) + \____/\____/_/ /_/\__/\__,_/\___/\__/ /_/ \___/_/ /____/\____/_/ /_/____/ + */ + + /** + * Gets a list of all contact persons + * @return Observable An observable list of contact persons + */ + getContactPersons(): Observable { + try { + return this.http.get((this.apiUrl + '/contactpersons')); + } catch (exception) { + process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`); + } + } + + /** + * Gets the specified contact person by id + * @param id the id of the contact person to get info about + * @return Observable An observable containing a single contact person + */ + getContactPersonById(id: number): Observable { + try { + return this.http.get((this.apiUrl + '/contactpersons/' + id)); + } catch (exception) { + process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`); + } + } + + /** + * Gets the contact persons for the specified vendor + * @param vendorId the id of the vendor to get the contact persons for + * @return Observable An observable list of contact persons + */ + getContactPersonsByVendor(vendorId: number): Observable { + try { + return this.http.get((this.apiUrl + '/contactpersons/byvendor/' + vendorId)); + } catch (exception) { + process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`); + } + } + + /** + * Adds a contact person for the specified vendor + * @param vendorId The id of the vendor to mark as favorite + * @param firstName The given name of the contact person + * @param lastName The family name of the contact person + * @param gender The gender of the contact person + * @param email The email address of the contact person + * @param phone The phone number of the contact person + * @return Observable The observable response of the api + */ + addContactPerson(vendorId: number, firstName: string, lastName: string, gender: string, email: string, phone: string): Observable { + try { + return this.http.post((this.apiUrl + '/contactpersons'), JSON.stringify({ + vendor_id: vendorId, + first_name: firstName, + last_name: lastName, + gender, + email, + phone + })); + } catch (exception) { + process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`); + } + } + + /** + * Updates the specified contact person record + * @param contactId The id of the contact person record + * @param vendorId The id of the vendor to mark as favorite + * @param firstName The given name of the contact person + * @param lastName The family name of the contact person + * @param gender The gender of the contact person + * @param email The email address of the contact person + * @param phone The phone number of the contact person + * @return Observable The observable response of the api + */ + updateContactPerson(contactId: number, vendorId: number, firstName: string, lastName: string, gender: string, email: string, phone: string): Observable { + try { + return this.http.put((this.apiUrl + '/contactpersons/' + contactId), JSON.stringify({ + vendor_id: vendorId, + first_name: firstName, + last_name: lastName, + gender, + email, + phone + })); + } catch (exception) { + process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`); + } + } + + + /* ______ __ _ + / ____/___ _/ /____ ____ _____ _____(_)__ _____ + / / / __ `/ __/ _ \/ __ `/ __ \/ ___/ / _ \/ ___/ + / /___/ /_/ / /_/ __/ /_/ / /_/ / / / / __(__ ) + \____/\__,_/\__/\___/\__, /\____/_/ /_/\___/____/ + /____/ + */ + + /** + * Gets the specified category from the API + * @param id The id of the category to get + * @return Observable An observable containing a single category + */ + getCategoryById(id: number): Observable { + try { + return this.http.get((this.apiUrl + '/categories/' + id)); + } catch (exception) { + process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`); + } + } + + + /** + * Gets a list of categories that match the given search term + * @param query The search term to match + * @return Observable An observable list of categories + */ + getCategoriesByQuery(query: string): Observable { + try { + return this.http.get((this.apiUrl + '/categories/search/' + query)); + } catch (exception) { + process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`); + } + } + + /** + * Gets a list of all categories + * @return Observable An observable list of categories + */ + getCategories(): Observable { + try { + return this.http.get((this.apiUrl + '/categories')); + } catch (exception) { + process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`); + } + } + + /* __ ___ ____ __ + / |/ /___ _____ __ __/ __/___ ______/ /___ __________ __________ + / /|_/ / __ `/ __ \/ / / / /_/ __ `/ ___/ __/ / / / ___/ _ \/ ___/ ___/ + / / / / /_/ / / / / /_/ / __/ /_/ / /__/ /_/ /_/ / / / __/ / (__ ) + /_/ /_/\__,_/_/ /_/\__,_/_/ \__,_/\___/\__/\__,_/_/ \___/_/ /____/ + */ + + /** + * Gets the specified manufacturer from the API + * @param id The id of the manufacturer to get + * @return Observable An observable containing a single manufacturer + */ + getManufacturerById(id: number): Observable { + try { + return this.http.get((this.apiUrl + '/manufacturers/' + id)); + } catch (exception) { + process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`); + } + } + + + /** + * Gets a list of manufacturers that match the given search term + * @param query The search term to match + * @return Observable An observable list of manufacturers + */ + getManufacturersByQuery(query: string): Observable { + try { + return this.http.get((this.apiUrl + '/manufacturers/search/' + query)); + } catch (exception) { + process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`); + } + } + + /** + * Gets a list of all manufacturers + * @return Observable An observable list of manufacturer + */ + getManufacturers(): Observable { + try { + return this.http.get((this.apiUrl + '/manufacturers')); + } catch (exception) { + process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`); + } + } + + + /* ______ ___ _____ __ __ + / ____/________ __ __/ (_)___ ____ _ / ___// /_____ _/ /___ _______ + / / / ___/ __ `/ | /| / / / / __ \/ __ `/ \__ \/ __/ __ `/ __/ / / / ___/ + / /___/ / / /_/ /| |/ |/ / / / / / / /_/ / ___/ / /_/ /_/ / /_/ /_/ (__ ) + \____/_/ \__,_/ |__/|__/_/_/_/ /_/\__, / /____/\__/\__,_/\__/\__,_/____/ + /____/ + */ + + /** + * Gets the current crawling status + * @return Observable An observable containing a single crawling status object + */ + getCurrentCrawlingStatus(): Observable { + try { + return this.http.get((this.apiUrl + '/crawlingstatus')); + } catch (exception) { + process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`); + } + } } diff --git a/README.md b/README.md index b9abce7..0d32e79 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ Wiki: https://github.com/Mueller-Patrick/Betterzon/wiki # Code Quality [![Codacy Badge](https://app.codacy.com/project/badge/Grade/88e47ebf837b43af9d12147c22f77f7f)](https://www.codacy.com/gh/Mueller-Patrick/Betterzon/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Mueller-Patrick/Betterzon&utm_campaign=Badge_Grade) +[![Code Coverage](https://img.shields.io/badge/coverage-82%25-green)](https://ci.betterzon.xyz) # Project Status [![Website Status](https://img.shields.io/website?label=www.betterzon.xyz&style=for-the-badge&url=https%3A%2F%2Fwww.betterzon.xyz)](https://www.betterzon.xyz) diff --git a/tests/Betterzon_API_Tests.postman_collection.json b/tests/Betterzon_API_Tests.postman_collection.json new file mode 100644 index 0000000..dfa60ed --- /dev/null +++ b/tests/Betterzon_API_Tests.postman_collection.json @@ -0,0 +1,1920 @@ +{ + "info": { + "_postman_id": "76b7db80-557f-44a6-8b86-f393beed8f86", + "name": "Betterzon API Tests", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "Categories", + "item": [ + { + "name": "GET all categories", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "https://backend.betterzon.xyz/categories/", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "categories", + "" + ] + } + }, + "response": [] + }, + { + "name": "GET single category", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "https://backend.betterzon.xyz/categories/1", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "categories", + "1" + ] + } + }, + "response": [] + }, + { + "name": "GET categories by query", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "https://backend.betterzon.xyz/categories/search/Elektro", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "categories", + "search", + "Elektro" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Contact Persons", + "item": [ + { + "name": "GET all contact persons", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "https://backend.betterzon.xyz/contactpersons", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "contactpersons" + ] + } + }, + "response": [] + }, + { + "name": "GET single contact person", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "https://backend.betterzon.xyz/contactpersons/1", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "contactpersons", + "1" + ] + } + }, + "response": [] + }, + { + "name": "GET contact persons by vendor", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "https://backend.betterzon.xyz/contactpersons/byvendor/1", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "contactpersons", + "byvendor", + "1" + ] + } + }, + "response": [] + }, + { + "name": "POST new contact person", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(201);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: 'https://backend.betterzon.xyz/users/login',\r", + " method: 'POST',\r", + " header: 'content-type:application/json',\r", + " body: {\r", + " mode: 'raw',\r", + " raw: JSON.stringify({\r", + " username: pm.collectionVariables.get(\"testuser_username\"),\r", + " password: pm.collectionVariables.get(\"testuser_password\")\r", + " })\r", + " }\r", + "}, function (err, response) {\r", + " pm.expect(err).to.not.be.ok;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"vendor_id\": 7,\r\n \"first_name\": \"Test\",\r\n \"last_name\": \"Contact\",\r\n \"gender\": \"Unix\",\r\n \"email\": \"testcontact@betterzon.xyz\",\r\n \"phone\": \"+49 123 456789\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "https://backend.betterzon.xyz/contactpersons/", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "contactpersons", + "" + ] + } + }, + "response": [] + }, + { + "name": "PUT update contact person", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: 'https://backend.betterzon.xyz/users/login',\r", + " method: 'POST',\r", + " header: 'content-type:application/json',\r", + " body: {\r", + " mode: 'raw',\r", + " raw: JSON.stringify({\r", + " username: pm.collectionVariables.get(\"testuser_username\"),\r", + " password: pm.collectionVariables.get(\"testuser_password\")\r", + " })\r", + " }\r", + "}, function (err, response) {\r", + " pm.expect(err).to.not.be.ok;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"vendor_id\": 7,\r\n \"first_name\": \"Test\",\r\n \"last_name\": \"Contact\",\r\n \"gender\": \"Unix\",\r\n \"email\": \"testcontact@betterzon.xyz\",\r\n \"phone\": \"+49 123 456789\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "https://backend.betterzon.xyz/contactpersons/2", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "contactpersons", + "2" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Crawling Status", + "item": [ + { + "name": "GET crawling status", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: 'https://backend.betterzon.xyz/users/login',\r", + " method: 'POST',\r", + " header: 'content-type:application/json',\r", + " body: {\r", + " mode: 'raw',\r", + " raw: JSON.stringify({\r", + " username: pm.collectionVariables.get(\"testuser_username\"),\r", + " password: pm.collectionVariables.get(\"testuser_password\")\r", + " })\r", + " }\r", + "}, function (err, response) {\r", + " pm.expect(err).to.not.be.ok;\r", + "});\r", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "https://backend.betterzon.xyz/crawlingstatus", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "crawlingstatus" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Favorite Shops", + "item": [ + { + "name": "GET favorite shops", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: 'https://backend.betterzon.xyz/users/login',\r", + " method: 'POST',\r", + " header: 'content-type:application/json',\r", + " body: {\r", + " mode: 'raw',\r", + " raw: JSON.stringify({\r", + " username: pm.collectionVariables.get(\"testuser_username\"),\r", + " password: pm.collectionVariables.get(\"testuser_password\")\r", + " })\r", + " }\r", + "}, function (err, response) {\r", + " pm.expect(err).to.not.be.ok;\r", + "});\r", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "https://backend.betterzon.xyz/favoriteshops", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "favoriteshops" + ] + } + }, + "response": [] + }, + { + "name": "POST create favorite shop entry", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(201);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: 'https://backend.betterzon.xyz/users/login',\r", + " method: 'POST',\r", + " header: 'content-type:application/json',\r", + " body: {\r", + " mode: 'raw',\r", + " raw: JSON.stringify({\r", + " username: pm.collectionVariables.get(\"testuser_username\"),\r", + " password: pm.collectionVariables.get(\"testuser_password\")\r", + " })\r", + " }\r", + "}, function (err, response) {\r", + " pm.expect(err).to.not.be.ok;\r", + "});\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"vendor_id\": 7\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "https://backend.betterzon.xyz/favoriteshops", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "favoriteshops" + ] + } + }, + "response": [] + }, + { + "name": "DELETE favorite shop entry", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(201);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: 'https://backend.betterzon.xyz/users/login',\r", + " method: 'POST',\r", + " header: 'content-type:application/json',\r", + " body: {\r", + " mode: 'raw',\r", + " raw: JSON.stringify({\r", + " username: pm.collectionVariables.get(\"testuser_username\"),\r", + " password: pm.collectionVariables.get(\"testuser_password\")\r", + " })\r", + " }\r", + "}, function (err, response) {\r", + " pm.expect(err).to.not.be.ok;\r", + " getNewFavId();\r", + "});\r", + "\r", + "\r", + "let getNewFavId = function() {\r", + " // Create a new shops entry so we can delete it afterwards\r", + " pm.sendRequest({\r", + " url: 'https://backend.betterzon.xyz/favoriteshops',\r", + " method: 'POST',\r", + " header: 'content-type:application/json',\r", + " body: {\r", + " mode: 'raw',\r", + " raw: JSON.stringify({\r", + " vendor_id: 7\r", + " })\r", + " }\r", + " }, function (err, response) {\r", + " pm.expect(err).to.not.be.ok;\r", + " });\r", + "\r", + " // Get the id of the entry\r", + " pm.sendRequest({\r", + " url: 'https://backend.betterzon.xyz/favoriteshops',\r", + " method: 'GET'\r", + " }, function (err, response) {\r", + " pm.expect(err).to.not.be.ok;\r", + " pm.collectionVariables.set(\"created_favshop_id\", response.json()[0].favorite_id);\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "https://backend.betterzon.xyz/favoriteshops/4", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "favoriteshops", + "4" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Manufacturers", + "item": [ + { + "name": "GET all manufacturers", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "https://backend.betterzon.xyz/manufacturers", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "manufacturers" + ] + } + }, + "response": [] + }, + { + "name": "GET single manufacturer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "https://backend.betterzon.xyz/manufacturers/1", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "manufacturers", + "1" + ] + } + }, + "response": [] + }, + { + "name": "GET manufacturers by query", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "https://backend.betterzon.xyz/manufacturers/search/Apple", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "manufacturers", + "search", + "Apple" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Price Alarms", + "item": [ + { + "name": "GET all price alarms", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: 'https://backend.betterzon.xyz/users/login',\r", + " method: 'POST',\r", + " header: 'content-type:application/json',\r", + " body: {\r", + " mode: 'raw',\r", + " raw: JSON.stringify({\r", + " username: pm.collectionVariables.get(\"testuser_username\"),\r", + " password: pm.collectionVariables.get(\"testuser_password\")\r", + " })\r", + " }\r", + "}, function (err, response) {\r", + " pm.expect(err).to.not.be.ok;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "https://backend.betterzon.xyz/pricealarms", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "pricealarms" + ] + } + }, + "response": [] + }, + { + "name": "POST new price alarm", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(201);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: 'https://backend.betterzon.xyz/users/login',\r", + " method: 'POST',\r", + " header: 'content-type:application/json',\r", + " body: {\r", + " mode: 'raw',\r", + " raw: JSON.stringify({\r", + " username: pm.collectionVariables.get(\"testuser_username\"),\r", + " password: pm.collectionVariables.get(\"testuser_password\")\r", + " })\r", + " }\r", + "}, function (err, response) {\r", + " pm.expect(err).to.not.be.ok;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"product_id\": 1,\r\n \"defined_price\": 23400\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "https://backend.betterzon.xyz/pricealarms", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "pricealarms" + ] + } + }, + "response": [] + }, + { + "name": "PUT update price alarm", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: 'https://backend.betterzon.xyz/users/login',\r", + " method: 'POST',\r", + " header: 'content-type:application/json',\r", + " body: {\r", + " mode: 'raw',\r", + " raw: JSON.stringify({\r", + " username: pm.collectionVariables.get(\"testuser_username\"),\r", + " password: pm.collectionVariables.get(\"testuser_password\")\r", + " })\r", + " }\r", + "}, function (err, response) {\r", + " pm.expect(err).to.not.be.ok;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"alarm_id\": 12,\r\n \"defined_price\": 23400\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "https://backend.betterzon.xyz/pricealarms", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "pricealarms" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Prices", + "item": [ + { + "name": "GET all prices", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "https://backend.betterzon.xyz/prices/", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "prices", + "" + ] + } + }, + "response": [] + }, + { + "name": "GET single price", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "https://backend.betterzon.xyz/prices/", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "prices", + "" + ] + } + }, + "response": [] + }, + { + "name": "GET best deals", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "https://backend.betterzon.xyz/prices/bestDeals/10", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "prices", + "bestDeals", + "10" + ] + } + }, + "response": [] + }, + { + "name": "GET prices by list of products", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "https://backend.betterzon.xyz/prices/byProduct/list/[1,2,3]", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "prices", + "byProduct", + "list", + "[1,2,3]" + ] + } + }, + "response": [] + }, + { + "name": "POST new price", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(201);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: 'https://backend.betterzon.xyz/users/login',\r", + " method: 'POST',\r", + " header: 'content-type:application/json',\r", + " body: {\r", + " mode: 'raw',\r", + " raw: JSON.stringify({\r", + " username: pm.collectionVariables.get(\"testuser_username\"),\r", + " password: pm.collectionVariables.get(\"testuser_password\")\r", + " })\r", + " }\r", + "}, function (err, response) {\r", + " pm.expect(err).to.not.be.ok;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"vendor_id\": 7,\r\n \"product_id\": 1,\r\n \"price_in_cents\": 123456\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "https://backend.betterzon.xyz/prices", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "prices" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Products", + "item": [ + { + "name": "GET all products", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "})" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "https://backend.betterzon.xyz/products/", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "products", + "" + ] + } + }, + "response": [] + }, + { + "name": "GET single product", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "})" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "https://backend.betterzon.xyz/products/1", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "products", + "1" + ] + } + }, + "response": [] + }, + { + "name": "GET products by query", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "})" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "https://backend.betterzon.xyz/products/search/iPhone", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "products", + "search", + "iPhone" + ] + } + }, + "response": [] + }, + { + "name": "GET products by list of ids", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "})" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "https://backend.betterzon.xyz/products/list/[1,2,3]", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "products", + "list", + "[1,2,3]" + ] + } + }, + "response": [] + }, + { + "name": "GET products by vendor", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "})" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "https://backend.betterzon.xyz/products/vendor/1", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "products", + "vendor", + "1" + ] + } + }, + "response": [] + }, + { + "name": "POST new product", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(201);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"asin\": \"B07X356256\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "https://backend.betterzon.xyz/products", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "products" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Users", + "item": [ + { + "name": "POST user registration negative", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(400);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"username\": \"Testuser\",\r\n \"password\": \"Testpassword\",\r\n \"email\": \"Wrongemail\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "https://backend.betterzon.xyz/users/register", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "users", + "register" + ] + } + }, + "response": [] + }, + { + "name": "POST user registration positive", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(201);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "const customerId = Math.floor((Math.random()*10000 +1));\r", + "pm.collectionVariables.set(\"rand_user_id\", customerId);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"username\": \"testuser_{{rand_user_id}}\",\r\n \"password\": \"supersecurepassword1234!\",\r\n \"email\": \"testuser_{{rand_user_id}}@betterzon.xyz\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "https://backend.betterzon.xyz/users/register", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "users", + "register" + ] + } + }, + "response": [] + }, + { + "name": "POST user login positive", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"username\": \"{{testuser_username}}\",\r\n \"password\": \"{{testuser_password}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "https://backend.betterzon.xyz/users/login", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "users", + "login" + ] + } + }, + "response": [] + }, + { + "name": "POST user login negative", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(401);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"username\": \"{{testuser_username}}\",\r\n \"password\": \"not_the_correct_password\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "https://backend.betterzon.xyz/users/login", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "users", + "login" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Vendors", + "item": [ + { + "name": "GET all vendors", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "https://backend.betterzon.xyz/vendors", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "vendors" + ] + } + }, + "response": [] + }, + { + "name": "GET single vendor", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "https://backend.betterzon.xyz/vendors/1", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "vendors", + "1" + ] + } + }, + "response": [] + }, + { + "name": "GET vendors by query", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "https://backend.betterzon.xyz/vendors/search/Apple", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "vendors", + "search", + "Apple" + ] + } + }, + "response": [] + }, + { + "name": "GET managed vendors", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Verify status code\", function() {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Verify body to be json\", function() {\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest({\r", + " url: 'https://backend.betterzon.xyz/users/login',\r", + " method: 'POST',\r", + " header: 'content-type:application/json',\r", + " body: {\r", + " mode: 'raw',\r", + " raw: JSON.stringify({\r", + " username: pm.collectionVariables.get(\"testuser_username\"),\r", + " password: pm.collectionVariables.get(\"testuser_password\")\r", + " })\r", + " }\r", + "}, function (err, response) {\r", + " pm.expect(err).to.not.be.ok;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "https://backend.betterzon.xyz/vendors/managed", + "protocol": "https", + "host": [ + "backend", + "betterzon", + "xyz" + ], + "path": [ + "vendors", + "managed" + ] + } + }, + "response": [] + } + ] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "testuser_username", + "value": "" + }, + { + "key": "testuser_password", + "value": "" + }, + { + "key": "created_favshop_id", + "value": "" + }, + { + "key": "rand_user_id", + "value": "" + } + ] +} \ No newline at end of file