Connexion-faker - Auto-generate mocks from your Connexion API using OpenAPI

Overview

Connexion Faker

PyPI

Get Started

Install

With poetry:

poetry add connexion-faker

# aiohttp
poetry add connexion-faker -E aiohttp

# django
poetry add connexion-faker -E django

With pip:

pip install connexion-faker

Use

Setting OpenAPI file config

Add x-fake attribute in property key:

openapi: "3.0.0"
info:
  title: Example
  version: 1.0.0
paths:
  /hello:
    get:
      summary: Hello
      responses:
        '200':
          description: Hello response.
          content:
            application/json:
              schema:
                type: object
                required:
                  - name
                properties:
                  name:
                    type: string
                    x-fake: name
  • Can be YAML or JSON

AIOHTTP Resolver

import connexion
from connexion_faker.aiohttp import AioHttpFakerMockResolver

resolver = AioHttpFakerMockResolver()

connexion_app = connexion.AioHttpApp(
    __name__, specification_dir="./", only_one_api=True
)
connexion_app.add_api(
    "./openapi.yml",
    validate_responses=True,
    pass_context_arg_name="request",
    resolver=resolver,
)
aiohttp_client(connexion_app.app)

Django Resolver

from django_connexion import DjangoApi
from connexion_faker.django import DjangoFakerMockResolver
from django.urls import path

resolver = DjangoFakerMockResolver()
doc_api = DjangoApi("./tests/openapi.yml", resolver=resolver)

urlpatterns = [
    path('', doc_api.urls),
]

Run tests

poetry run pytest
You might also like...
Language-agnostic HTTP API Testing Tool
Language-agnostic HTTP API Testing Tool

Dredd — HTTP API Testing Framework Dredd is a language-agnostic command-line tool for validating API description document against backend implementati

Turn any OpenAPI2/3 and Postman Collection file into an API server with mocking, transformations and validations.

Prism is a set of packages for API mocking and contract testing with OpenAPI v2 (formerly known as Swagger) and OpenAPI v3.x. Mock Servers: Life-like

Lightweight, scriptable browser as a service with an HTTP API

Splash - A javascript rendering service Splash is a javascript rendering service with an HTTP API. It's a lightweight browser with an HTTP API, implem

Automated Security Testing For REST API's
Automated Security Testing For REST API's

Astra REST API penetration testing is complex due to continuous changes in existing APIs and newly added APIs. Astra can be used by security engineers

Simple assertion library for unit testing in python with a fluent API

assertpy Simple assertions library for unit testing in Python with a nice fluent API. Supports both Python 2 and 3. Usage Just import the assert_that

API mocking with Python.

apyr apyr (all lowercase) is a simple & easy to use mock API server. It's great for front-end development when your API is not ready, or when you are

ApiPy was created for api testing with Python pytest framework which has also requests, assertpy and pytest-html-reporter libraries.
ApiPy was created for api testing with Python pytest framework which has also requests, assertpy and pytest-html-reporter libraries.

ApiPy was created for api testing with Python pytest framework which has also requests, assertpy and pytest-html-reporter libraries. With this f

Multi-asset backtesting framework. An intuitive API lets analysts try out their strategies right away
Multi-asset backtesting framework. An intuitive API lets analysts try out their strategies right away

Multi-asset backtesting framework. An intuitive API lets analysts try out their strategies right away. Fast execution of profit-take/loss-cut orders is built-in. Seamless with Pandas.

AutoExploitSwagger is an automated API security testing exploit tool that can be combined with xray, BurpSuite and other scanners.
AutoExploitSwagger is an automated API security testing exploit tool that can be combined with xray, BurpSuite and other scanners.

AutoExploitSwagger is an automated API security testing exploit tool that can be combined with xray, BurpSuite and other scanners.

Releases(0.2.0)
Owner
Erle Carrara
Erle Carrara
Test utility for validating OpenAPI documentation

DRF OpenAPI Tester This is a test utility to validate DRF Test Responses against OpenAPI 2 and 3 schema. It has built-in support for: OpenAPI 2/3 yaml

snok 103 Dec 21, 2022
A python bot using the Selenium library to auto-buy specified sneakers on the nike.com website.

Sneaker-Bot-UK A python bot using the Selenium library to auto-buy specified sneakers on the nike.com website. This bot is still in development and is

Daniel Hinds 4 Dec 14, 2022
Auto Click by pyautogui and excel operations.

Auto Click by pyautogui and excel operations.

Janney 2 Dec 21, 2021
Auto-hms-action - Automation of NU Health Management System

?? Automation of NU Health Management System ?? 長崎大学 健康管理システムの自動化 ?? Usage / 使い方

k5-mot 3 Mar 4, 2022
A modern API testing tool for web applications built with Open API and GraphQL specifications.

Schemathesis Schemathesis is a modern API testing tool for web applications built with Open API and GraphQL specifications. It reads the application s

Schemathesis.io 1.6k Jan 6, 2023
A modern API testing tool for web applications built with Open API and GraphQL specifications.

Schemathesis Schemathesis is a modern API testing tool for web applications built with Open API and GraphQL specifications. It reads the application s

Schemathesis.io 1.6k Dec 30, 2022
Generate random test credit card numbers for testing, validation and/or verification purposes.

Generate random test credit card numbers for testing, validation and/or verification purposes.

Dark Hunter 141 5 Nov 14, 2022
It's a simple script to generate a mush on code forces, the script will accept the public problem urls only or polygon problems.

Codeforces-Sheet-Generator It's a simple script to generate a mushup on code forces, the script will accept the public problem urls only or polygon pr

Ahmed Hossam 10 Aug 2, 2022
This project is used to send a screenshot by email of your MyUMons schedule using Selenium python lib (headless mode)

MyUMonsSchedule Use MyUMonsSchedule python script to send a screenshot by email (Gmail) of your MyUMons schedule. If you use it on Windows, take care

Pierre-Louis D'Agostino 6 May 12, 2022