diff options
author | CoprDistGit <infra@openeuler.org> | 2023-06-20 06:03:24 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-06-20 06:03:24 +0000 |
commit | a392834cbc3d185f213c3a6639f153e27bf78c8d (patch) | |
tree | b8de206cb53481c5b99b905a57a6742bf116a46b | |
parent | 89929e056e0b2b6e231a9864b59c554f926fc18b (diff) |
automatic import of python-pytest-falconopeneuler20.03
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-pytest-falcon.spec | 243 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 245 insertions, 0 deletions
@@ -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 +[](https://travis-ci.org/yohanboniface/pytest-falcon) [](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 +[](https://travis-ci.org/yohanboniface/pytest-falcon) [](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 +[](https://travis-ci.org/yohanboniface/pytest-falcon) [](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 <Python_Bot@openeuler.org> - 0.4.2-1 +- Package Spec generated @@ -0,0 +1 @@ +a04be8da292dad1ae319048075e57647 pytest-falcon-0.4.2.tar.gz |