Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (testpypi.python.org).
Help us improve Python packaging - Donate today!

Integration of Falcon API unit tests with Bravado.

Project Description

Integration of Falcon API unit tests with Bravado. For testing your application’s contract.

You can easily implement Bravado integrations for other frameworks’ unit tests (e.g. Flask’s) based on this code.

This library doesn’t do much, but it’s actually feature-complete (there weren’t that many features to implement…).

One thing that can be changed in the future is the way Falcon requests are simulated. Right now it’s done with pytest-falcon, but you don’t have to use Pytest in your tests (but it’s great and you probably should at least check it out).

Usage

from bravado.client import SwaggerClient
from bravado_falcon import FalconHttpClient

api = get_falcon_api() # get a falcon.API
swagger_spec = get_swagger_spec() # dict created by loading a YAML or JSON from a file

client = SwaggerClient.from_spec(swagger_spec,
                                 http_client=FalconHttpClient(api))

# "v1" is the first part of a path (e.g. "/v1/shopping/lists")
# "getList" is the "operationId" element for an endpoint from Swagger
# "id" is a path parameter (let's say from "/v1/shopping/lists/{id}")
# See Bravado docs for more information.
list_object = client.v1.getList(id='list-id').result()

# now make assertions about the returned object
Release History

Release History

This version
History Node

0.1.0

History Node

0.0.1

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting