qxf2 / cars-api

A sample REST application to help testers learn to write API automation
MIT License
6 stars 20 forks source link

Modified the service file to host the app with 1 Gunicorn worker #30

Closed shivahari closed 4 months ago

shivahari commented 5 months ago

Modifie the systemd service file to run the app on 1 worker while hosting the app.

avinash010 commented 4 months ago

Tested this using session against https://cars-app.qxf2.com/ by adding a new car and the changes look good.


>>> response = my_session.get(url='http://cars-app.qxf2.com/cars',auth=("qxf2","qxf2"))
>>> response.json()
{'cars_list': [{'brand': 'Maruti', 'car_type': 'hatchback', 'name': 'Swift', 'price_range': '3-5 lacs'}, {'brand': 'Hyundai', 'car_type': 'hatchback', 'name': 'Creta', 'price_range': '8-14 lacs'}, {'brand': 'Honda', 'car_type': 'sedan', 'name': 'City', 'price_range': '3-6 lacs'}, {'brand': 'Volkswagen', 'car_type': 'sedan', 'name': 'Vento', 'price_range': '7-10 lacs'}], 'successful': True}
>>>response = my_session.post(url='http://cars-app.qxf2.com/cars/add',json={'name':'figo','brand':'Ford','price_range':'2-3lacs','car_type':'hatchback'},auth=("qxf2","qxf2"))
>>> response = my_session.get(url='http://cars-app.qxf2.com/cars',auth=("qxf2","qxf2"))
>>> response.json()
{'cars_list': [{'brand': 'Maruti', 'car_type': 'hatchback', 'name': 'Swift', 'price_range': '3-5 lacs'}, {'brand': 'Hyundai', 'car_type': 'hatchback', 'name': 'Creta', 'price_range': '8-14 lacs'}, {'brand': 'Honda', 'car_type': 'sedan', 'name': 'City', 'price_range': '3-6 lacs'}, {'brand': 'Volkswagen', 'car_type': 'sedan', 'name': 'Vento', 'price_range': '7-10 lacs'}, {'brand': 'Ford', 'car_type': 'hatchback', 'name': 'figo', 'price_range': '2-3lacs'}], 'successful': True}```