%global _empty_manifest_terminate_build 0 Name: python-async-asgi-testclient Version: 1.4.11 Release: 1 Summary: Async client for testing ASGI web applications License: MIT license URL: https://github.com/vinissimus/async-asgi-testclient Source0: https://mirrors.nju.edu.cn/pypi/web/packages/52/9a/0eb3fd37d4f9ad1e9b2b6d6b91357d3ebf7534271c32e343185a5d204903/async-asgi-testclient-1.4.11.tar.gz BuildArch: noarch %description # async-asgi-testclient [![Build Status](https://travis-ci.com/vinissimus/async-asgi-testclient.svg?branch=master)](https://travis-ci.com/vinissimus/async-asgi-testclient) [![PyPI version](https://badge.fury.io/py/async-asgi-testclient.svg)](https://badge.fury.io/py/async-asgi-testclient) ![](https://img.shields.io/pypi/pyversions/async-asgi-testclient.svg) [![Codcov](https://codecov.io/gh/vinissimus/async-asgi-testclient/branch/master/graph/badge.svg)](https://codecov.io/gh/vinissimus/async-asgi-testclient/branch/master) ![](https://img.shields.io/github/license/vinissimus/async-asgi-testclient) Async ASGI TestClient is a library for testing web applications that implements ASGI specification (version 2 and 3). The motivation behind this project is building a common testing library that doesn't depend on the web framework ([Quart](https://gitlab.com/pgjones/quart), [Startlette](https://github.com/encode/starlette), ...). It works by calling the ASGI app directly. This avoids the need to run the app with a http server in a different process/thread/asyncio-loop. Since the app and test run in the same asyncio loop, it's easier to write tests and debug code. This library is based on the testing module provided in [Quart](https://gitlab.com/pgjones/quart). ## Quickstart Requirements: Python 3.6+ Installation: ```bash pip install async-asgi-testclient ``` ## Usage `my_api.py`: ```python from quart import Quart, jsonify app = Quart(__name__) @app.route("/") async def root(): return "plain response" @app.route("/json") async def json(): return jsonify({"hello": "world"}) if __name__ == '__main__': app.run() ``` `test_app.py`: ```python from async_asgi_testclient import TestClient import pytest @pytest.mark.asyncio async def test_quart_app(): from .my_api import app async with TestClient(app) as client: resp = await client.get("/") assert resp.status_code == 200 assert resp.text == "plain response" resp = await client.get("/json") assert resp.status_code == 200 assert resp.json() == {"hello": "world"} ``` ## Supports - [X] cookies - [X] multipart/form-data - [X] follow redirects - [X] response streams - [X] request streams - [X] websocket support %package -n python3-async-asgi-testclient Summary: Async client for testing ASGI web applications Provides: python-async-asgi-testclient BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-async-asgi-testclient # async-asgi-testclient [![Build Status](https://travis-ci.com/vinissimus/async-asgi-testclient.svg?branch=master)](https://travis-ci.com/vinissimus/async-asgi-testclient) [![PyPI version](https://badge.fury.io/py/async-asgi-testclient.svg)](https://badge.fury.io/py/async-asgi-testclient) ![](https://img.shields.io/pypi/pyversions/async-asgi-testclient.svg) [![Codcov](https://codecov.io/gh/vinissimus/async-asgi-testclient/branch/master/graph/badge.svg)](https://codecov.io/gh/vinissimus/async-asgi-testclient/branch/master) ![](https://img.shields.io/github/license/vinissimus/async-asgi-testclient) Async ASGI TestClient is a library for testing web applications that implements ASGI specification (version 2 and 3). The motivation behind this project is building a common testing library that doesn't depend on the web framework ([Quart](https://gitlab.com/pgjones/quart), [Startlette](https://github.com/encode/starlette), ...). It works by calling the ASGI app directly. This avoids the need to run the app with a http server in a different process/thread/asyncio-loop. Since the app and test run in the same asyncio loop, it's easier to write tests and debug code. This library is based on the testing module provided in [Quart](https://gitlab.com/pgjones/quart). ## Quickstart Requirements: Python 3.6+ Installation: ```bash pip install async-asgi-testclient ``` ## Usage `my_api.py`: ```python from quart import Quart, jsonify app = Quart(__name__) @app.route("/") async def root(): return "plain response" @app.route("/json") async def json(): return jsonify({"hello": "world"}) if __name__ == '__main__': app.run() ``` `test_app.py`: ```python from async_asgi_testclient import TestClient import pytest @pytest.mark.asyncio async def test_quart_app(): from .my_api import app async with TestClient(app) as client: resp = await client.get("/") assert resp.status_code == 200 assert resp.text == "plain response" resp = await client.get("/json") assert resp.status_code == 200 assert resp.json() == {"hello": "world"} ``` ## Supports - [X] cookies - [X] multipart/form-data - [X] follow redirects - [X] response streams - [X] request streams - [X] websocket support %package help Summary: Development documents and examples for async-asgi-testclient Provides: python3-async-asgi-testclient-doc %description help # async-asgi-testclient [![Build Status](https://travis-ci.com/vinissimus/async-asgi-testclient.svg?branch=master)](https://travis-ci.com/vinissimus/async-asgi-testclient) [![PyPI version](https://badge.fury.io/py/async-asgi-testclient.svg)](https://badge.fury.io/py/async-asgi-testclient) ![](https://img.shields.io/pypi/pyversions/async-asgi-testclient.svg) [![Codcov](https://codecov.io/gh/vinissimus/async-asgi-testclient/branch/master/graph/badge.svg)](https://codecov.io/gh/vinissimus/async-asgi-testclient/branch/master) ![](https://img.shields.io/github/license/vinissimus/async-asgi-testclient) Async ASGI TestClient is a library for testing web applications that implements ASGI specification (version 2 and 3). The motivation behind this project is building a common testing library that doesn't depend on the web framework ([Quart](https://gitlab.com/pgjones/quart), [Startlette](https://github.com/encode/starlette), ...). It works by calling the ASGI app directly. This avoids the need to run the app with a http server in a different process/thread/asyncio-loop. Since the app and test run in the same asyncio loop, it's easier to write tests and debug code. This library is based on the testing module provided in [Quart](https://gitlab.com/pgjones/quart). ## Quickstart Requirements: Python 3.6+ Installation: ```bash pip install async-asgi-testclient ``` ## Usage `my_api.py`: ```python from quart import Quart, jsonify app = Quart(__name__) @app.route("/") async def root(): return "plain response" @app.route("/json") async def json(): return jsonify({"hello": "world"}) if __name__ == '__main__': app.run() ``` `test_app.py`: ```python from async_asgi_testclient import TestClient import pytest @pytest.mark.asyncio async def test_quart_app(): from .my_api import app async with TestClient(app) as client: resp = await client.get("/") assert resp.status_code == 200 assert resp.text == "plain response" resp = await client.get("/json") assert resp.status_code == 200 assert resp.json() == {"hello": "world"} ``` ## Supports - [X] cookies - [X] multipart/form-data - [X] follow redirects - [X] response streams - [X] request streams - [X] websocket support %prep %autosetup -n async-asgi-testclient-1.4.11 %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-async-asgi-testclient -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Tue Apr 11 2023 Python_Bot - 1.4.11-1 - Package Spec generated