{"id":13725124,"url":"https://github.com/vinissimus/async-asgi-testclient","last_synced_at":"2025-04-04T19:10:53.033Z","repository":{"id":34726038,"uuid":"181481577","full_name":"vinissimus/async-asgi-testclient","owner":"vinissimus","description":"A framework-agnostic library for testing ASGI web applications","archived":false,"fork":false,"pushed_at":"2023-06-29T14:52:47.000Z","size":79,"stargazers_count":160,"open_issues_count":15,"forks_count":20,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-28T18:13:01.343Z","etag":null,"topics":["asgi","guillotina","quart","starlette","testing"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vinissimus.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-15T12:26:06.000Z","updated_at":"2025-01-16T09:03:31.000Z","dependencies_parsed_at":"2024-06-18T16:39:06.233Z","dependency_job_id":"4fc72b2b-1508-452a-b8b8-0a1a65c0d541","html_url":"https://github.com/vinissimus/async-asgi-testclient","commit_stats":{"total_commits":52,"total_committers":16,"mean_commits":3.25,"dds":0.5961538461538461,"last_synced_commit":"94ee684e7e9a33b96b9e9d5c86e1d048d2ddb8ff"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinissimus%2Fasync-asgi-testclient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinissimus%2Fasync-asgi-testclient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinissimus%2Fasync-asgi-testclient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinissimus%2Fasync-asgi-testclient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vinissimus","download_url":"https://codeload.github.com/vinissimus/async-asgi-testclient/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247234921,"owners_count":20905854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asgi","guillotina","quart","starlette","testing"],"created_at":"2024-08-03T01:02:13.656Z","updated_at":"2025-04-04T19:10:53.015Z","avatar_url":"https://github.com/vinissimus.png","language":"Python","funding_links":[],"categories":["Python","Testing","Testing Frameworks"],"sub_categories":["Tutorials"],"readme":"# async-asgi-testclient\n\n[![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)\n\nAsync ASGI TestClient is a library for testing web applications that implements ASGI specification (version 2 and 3).\n\nThe 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), ...).\n\nIt 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.\n\nThis library is based on the testing module provided in [Quart](https://gitlab.com/pgjones/quart).\n\n## Quickstart\n\nRequirements: Python 3.6+\n\nInstallation:\n\n```bash\npip install async-asgi-testclient\n```\n\n## Usage\n\n`my_api.py`:\n```python\nfrom quart import Quart, jsonify\n\napp = Quart(__name__)\n\n@app.route(\"/\")\nasync def root():\n    return \"plain response\"\n\n@app.route(\"/json\")\nasync def json():\n    return jsonify({\"hello\": \"world\"})\n\nif __name__ == '__main__':\n    app.run()\n```\n\n`test_app.py`:\n```python\nfrom async_asgi_testclient import TestClient\n\nimport pytest\n\n@pytest.mark.asyncio\nasync def test_quart_app():\n    from .my_api import app\n\n    async with TestClient(app) as client:\n        resp = await client.get(\"/\")\n        assert resp.status_code == 200\n        assert resp.text == \"plain response\"\n\n        resp = await client.get(\"/json\")\n        assert resp.status_code == 200\n        assert resp.json() == {\"hello\": \"world\"}\n```\n\n## Supports\n\n - [X] cookies\n - [X] multipart/form-data\n - [X] follow redirects\n - [X] response streams\n - [X] request streams\n - [X] websocket support\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinissimus%2Fasync-asgi-testclient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvinissimus%2Fasync-asgi-testclient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinissimus%2Fasync-asgi-testclient/lists"}