Skip to main content
[![Build Status](https://travis-ci.org/yohanboniface/pytest-falcon.svg?branch=master)](https://travis-ci.org/yohanboniface/pytest-falcon) [![Pypi version](https://img.shields.io/pypi/v/pytest-falcon.svg)](https://pypi.python.org/pypi/pytest-falcon)

# Pytest-Falcon

Pytest helpers for the Falcon framework.


## Install

```
pip install pytest-falcon
```


## Usage

You must create an `app` fixture to expose the Falcon application you want to test:

```python
import falcon
import pytest


application = falcon.API()
application.req_options.auto_parse_form_urlencoded = True


@pytest.fixture
def app():
return application
```

## Fixtures

### client

Allows you to test your API:

```python
class Resource:

def on_post(self, req, resp, **kwargs):
resp.body = json.dumps(req.params)

application.add_route('/route', Resource())

def test_post(client):
resp = client.post('/route', {'myparam': 'myvalue'})
assert resp.status == falcon.HTTP_OK
assert resp.json['myparam'] == 'myvalue'
```

Response properties:
- `body` the body as `str`
- `json` the body parsed as json when the response content-type is 'application/json'
- `headers` the response headers
- `status` the response status, as `str` ('200 OK', '405 Method Not Allowed'…)
- `status_code` the response status code, as `int` (200, 201…)

Release files for pytest-falcon 0.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-falcon 0.4.2
File Size Uploaded
pytest-falcon-0.4.2.tar.gz 4.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-falcon 0.4.2
File Interpreter ABI Platform
pytest_falcon-0.4.2-py3-none-any.whl Python 3 none any Details

Total release size: 10.2 kB

Release files / pytest-falcon-0.4.2.tar.gz

Download URL pytest-falcon-0.4.2.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b196d169ad756cfae46b39c48196af5ebb6e3f7d3c2a5f59cd5979462dcf7dfa
BLAKE2b-256 checksum
How to use checksums
efc57fb0173d814e7c7127a92b7060b9554751cabd28afec48eb5a18af4d7d6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pytest_falcon-0.4.2-py3-none-any.whl

Download URL pytest_falcon-0.4.2-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4c54c89f6c83b0ef12db5dc4fd129c2255aeabb20467190696a57ffd9bde394
BLAKE2b-256 checksum
How to use checksums
9ab73ac18f19d8cf6a28b2d6f01536b63155afed08e4a76c4b4682feecfa5a22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.4.2 This release

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.3

3 release files

0.3.2

3 release files

0.3.1

3 release files

0.3.0

1 release file

0.2.0

2 release files

0.1.2

2 release files

0.1.1

1 release file

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page