api package

Submodules

api.authentication_helper module

Authentication Helper Class

class api.authentication_helper.AuthenticationHelper[source]

Bases: object

Authentication Helper Class. Contains helper methods for cars_app app

static authenticate_error(auth_flag)[source]

set auth message based on the authentication check result :param auth_flag: :return:

static check_auth(username, password, user_list)[source]

check if the given user is valid :param user_list: :param username: :param password: :return:

api.cars_app module

cars api is a sample web application developed by Qxf2 Services to help testers learn API automation. This REST application written in Python was built solely to help QA learn to write API automation. The application has endpoints for you to practice automating GET, POST, PUT and DELETE methods. It includes endpoints that use URL parameters, jSON payloads, returns different response codes, etc. We have also included permissioning and authentication too to help you write role based API tests.

IMPORTANT DISCLAIMER: The code here does not reflect Qxf2’s coding standards and practices.

Source: https://github.com/qxf2/cars-api

api.cars_app.add_car()[source]

this will help test POST without url params :return:

api.cars_app.delete_registered_cars()[source]

this will help test delete :return:

api.cars_app.filter_cars(car_type)[source]

get cars of the given car type :param car_type: :return:

api.cars_app.get_car()[source]

this will help test GET with url params :return:

api.cars_app.get_car_details(name)[source]

this will help test GET with url params :param name: :return:

api.cars_app.get_cars()[source]

this will help test GET without url params :return:

api.cars_app.get_registered_cars()[source]

this will help test GET without url_params :return:

api.cars_app.get_user_list()[source]

return user list if the given authenticated user has admin permission :return:

api.cars_app.index_page()[source]

this will help test GET without url params :return:

api.cars_app.register_car()[source]

this will help test GET and POST with dynamic numbers in url :return:

api.cars_app.remove_car(name)[source]

this will help test DELETE :param name: :return:

api.cars_app.requires_auth(f)[source]

verify given user authentication details :param f: :return:

api.cars_app.requires_perm()[source]

check if the authenticated user has a admin permission :return:

api.cars_app.update_car(name)[source]

this will help test PUT :param name: :return:

Module contents