# webtest-sanic
Integration of [WebTest](https://github.com/Pylons/webtest) with [Sanic](https://github.com/huge-success/sanic) applications
Initially it was created to enable Sanic support in [Webargs](https://github.com/sloria/webargs) module
[![Build Status](https://img.shields.io/travis/EndurantDevs/webtest-sanic.svg?logo=travis)](https://app.travis-ci.com/EndurantDevs/webtest-sanic) [![Latest Version](https://pypip.in/version/webtest-sanic/badge.svg)](https://pypi.python.org/pypi/webtest-sanic/) [![Python Versions](https://img.shields.io/pypi/pyversions/webtest-sanic.svg)](https://github.com/EndurantDevs/webtest-sanic/blob/master/setup.py) [![Tests Coverage](https://img.shields.io/codecov/c/github/EndurantDevs/webtest-sanic/master.svg)](https://codecov.io/gh/EndurantDevs/webtest-sanic)
### Example Code ###
```python
import asyncio
from sanic import Sanic
from sanic.response import json
from webtest_sanic import TestApp
app = Sanic()
@app.route('/')
async def test(request):
return json({'hello': 'world'})
loop = asyncio.new_event_loop()
def test_hello():
client = TestApp(app, loop=loop)
res = client.get('/')
assert res.status_code == 200
assert res.json == {'message': 'Hello world'}
```
### Installing
It is easy to do from `pip`
```
pip install webtest-sanic
```
or from sources
```
git clone git@github.com:EndurantDevs/webtest-sanic.git
cd webtest-sanic
python setup.py install
```
## Running the tests
To be sure everything is fine before installation from sources, just run:
```
python setup.py test
```
Or
```
pytest tests/
```
### Credits ###
This code is based on [webtest-aiohttp](https://github.com/sloria/webtest-aiohttp) by [Steven Loria](https://github.com/sloria) and [pytest-sanic](https://github.com/yunstanford/pytest-sanic) by [Yun Xu](https://github.com/yunstanford)
Please check [NOTICE](NOTICE.md) for more info.
Raw data
{
"_id": null,
"home_page": "https://github.com/EndurantDevs/webtest_sanic",
"name": "webtest-sanic",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "webtest-sanic webtest sanic testing wsgi asyncio",
"author": "Endurant Devs, Dmytro Nikolayev",
"author_email": "info@endurantdev.com",
"download_url": "",
"platform": "",
"description": "# webtest-sanic\nIntegration of [WebTest](https://github.com/Pylons/webtest) with [Sanic](https://github.com/huge-success/sanic) applications\nInitially it was created to enable Sanic support in [Webargs](https://github.com/sloria/webargs) module\n\n[![Build Status](https://img.shields.io/travis/EndurantDevs/webtest-sanic.svg?logo=travis)](https://app.travis-ci.com/EndurantDevs/webtest-sanic) [![Latest Version](https://pypip.in/version/webtest-sanic/badge.svg)](https://pypi.python.org/pypi/webtest-sanic/) [![Python Versions](https://img.shields.io/pypi/pyversions/webtest-sanic.svg)](https://github.com/EndurantDevs/webtest-sanic/blob/master/setup.py) [![Tests Coverage](https://img.shields.io/codecov/c/github/EndurantDevs/webtest-sanic/master.svg)](https://codecov.io/gh/EndurantDevs/webtest-sanic)\n\n### Example Code ###\n\n```python\n import asyncio\n\n from sanic import Sanic\n from sanic.response import json\n from webtest_sanic import TestApp\n\n app = Sanic()\n\n @app.route('/')\n async def test(request):\n return json({'hello': 'world'})\n\n loop = asyncio.new_event_loop()\n\n def test_hello():\n client = TestApp(app, loop=loop)\n res = client.get('/')\n assert res.status_code == 200\n assert res.json == {'message': 'Hello world'}\n```\n\n\n### Installing\n\nIt is easy to do from `pip`\n\n```\npip install webtest-sanic\n```\n\nor from sources\n\n```\ngit clone git@github.com:EndurantDevs/webtest-sanic.git\ncd webtest-sanic\npython setup.py install\n```\n\n## Running the tests\n\nTo be sure everything is fine before installation from sources, just run:\n```\npython setup.py test\n```\nOr\n```\npytest tests/\n```\n\n### Credits ###\n\nThis code is based on [webtest-aiohttp](https://github.com/sloria/webtest-aiohttp) by [Steven Loria](https://github.com/sloria) and [pytest-sanic](https://github.com/yunstanford/pytest-sanic) by [Yun Xu](https://github.com/yunstanford)\nPlease check [NOTICE](NOTICE.md) for more info.\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "webtest-sanic provides integration of WebTest with Sanic applications",
"version": "0.4.2",
"project_urls": {
"Homepage": "https://github.com/EndurantDevs/webtest_sanic"
},
"split_keywords": [
"webtest-sanic",
"webtest",
"sanic",
"testing",
"wsgi",
"asyncio"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c28ea3a25ed6225b651ec627847632db8ab0098b407777a9c49aec0f119864c1",
"md5": "a21615b25481ae6ddab20271a575b977",
"sha256": "46fd541f64ec9b6b03536ab83c5b645c36b6222fc93399b5da2e562efc55f427"
},
"downloads": -1,
"filename": "webtest_sanic-0.4.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a21615b25481ae6ddab20271a575b977",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7479,
"upload_time": "2021-09-06T09:20:15",
"upload_time_iso_8601": "2021-09-06T09:20:15.560937Z",
"url": "https://files.pythonhosted.org/packages/c2/8e/a3a25ed6225b651ec627847632db8ab0098b407777a9c49aec0f119864c1/webtest_sanic-0.4.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2021-09-06 09:20:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "EndurantDevs",
"github_project": "webtest_sanic",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "aiohttp",
"specs": []
},
{
"name": "codecov",
"specs": [
[
">=",
"2.0.15"
]
]
},
{
"name": "coverage",
"specs": [
[
">=",
"4.5.1"
]
]
},
{
"name": "pytest",
"specs": [
[
">=",
"5.0.1"
]
]
},
{
"name": "pytest-cov",
"specs": [
[
">=",
"2.6.0"
]
]
},
{
"name": "sanic",
"specs": [
[
">=",
"18.12.0"
]
]
},
{
"name": "webtest",
"specs": []
}
],
"lcname": "webtest-sanic"
}