From a392834cbc3d185f213c3a6639f153e27bf78c8d Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Tue, 20 Jun 2023 06:03:24 +0000 Subject: automatic import of python-pytest-falcon --- .gitignore | 1 + python-pytest-falcon.spec | 243 ++++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 245 insertions(+) create mode 100644 python-pytest-falcon.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..429350d 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/pytest-falcon-0.4.2.tar.gz diff --git a/python-pytest-falcon.spec b/python-pytest-falcon.spec new file mode 100644 index 0000000..e133cc5 --- /dev/null +++ b/python-pytest-falcon.spec @@ -0,0 +1,243 @@ +%global _empty_manifest_terminate_build 0 +Name: python-pytest-falcon +Version: 0.4.2 +Release: 1 +Summary: Pytest helpers for Falcon. +License: WTFPL +URL: https://github.com/yohanboniface/pytest-falcon +Source0: https://mirrors.aliyun.com/pypi/web/packages/ef/c5/7fb0173d814e7c7127a92b7060b9554751cabd28afec48eb5a18af4d7d6b/pytest-falcon-0.4.2.tar.gz +BuildArch: noarch + + +%description +[![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…) + +%package -n python3-pytest-falcon +Summary: Pytest helpers for Falcon. +Provides: python-pytest-falcon +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-pytest-falcon +[![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…) + +%package help +Summary: Development documents and examples for pytest-falcon +Provides: python3-pytest-falcon-doc +%description help +[![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…) + +%prep +%autosetup -n pytest-falcon-0.4.2 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-pytest-falcon -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Jun 20 2023 Python_Bot - 0.4.2-1 +- Package Spec generated diff --git a/sources b/sources new file mode 100644 index 0000000..63a940e --- /dev/null +++ b/sources @@ -0,0 +1 @@ +a04be8da292dad1ae319048075e57647 pytest-falcon-0.4.2.tar.gz -- cgit v1.2.3