diff options
author | Ivan Dolgov <ivan@dolgov.fi> | 2019-04-06 15:17:08 +0300 |
---|---|---|
committer | Ivan Dolgov <ivan@dolgov.fi> | 2019-04-06 15:17:08 +0300 |
commit | 0146d3488826d82292b91426ea1d0655bfe38a9d (patch) | |
tree | d09136f905b1ac54d5660e290537a1cb81e35b53 | |
parent | f09185c5c2bc327103a61ca4c9ed2f8ae2916802 (diff) | |
parent | ab9c02fd365dde7c4f26ff57898410504e03b895 (diff) | |
download | ickapi-master.tar.gz |
-rw-r--r-- | Makefile | 9 | ||||
-rw-r--r-- | apitest/test_version.py | 13 | ||||
-rw-r--r-- | gunicorn.conf | 2 | ||||
-rw-r--r-- | setup.py | 6 |
4 files changed, 24 insertions, 6 deletions
@@ -12,7 +12,12 @@ lint: pycodestyle ickapi pylint -j0 -d missing-docstring ickapi -test: lint +apitest: + gunicorn --config gunicorn.conf ickapi.main:app > /dev/null 2>&1 & + pytest --rootdir=apitest || true + pkill -F ickapi.pid + +test: lint apitest run: gunicorn --config gunicorn.conf --reload ickapi.main:app @@ -25,4 +30,4 @@ clean: reset: clean rm -rf env/ -.PHONY: all env lint test run clean reset +.PHONY: all env lint apitest test run clean reset diff --git a/apitest/test_version.py b/apitest/test_version.py new file mode 100644 index 0000000..1d72cd8 --- /dev/null +++ b/apitest/test_version.py @@ -0,0 +1,13 @@ +"""Version endpoint test module. +""" + +import aiohttp + + +async def test_version(): + """Test version endpoint""" + async with aiohttp.ClientSession() as session: + async with session.get('http://0.0.0.0:8080/version') as resp: + assert resp.status == 200 + resp = await resp.json() + assert 'api' in resp.keys() diff --git a/gunicorn.conf b/gunicorn.conf index 81c8aa1..52acf44 100644 --- a/gunicorn.conf +++ b/gunicorn.conf @@ -4,4 +4,4 @@ worker_class = 'aiohttp.worker.GunicornWebWorker' errorlog = '-' accesslog = '-' loglevel = 'info' -pidfile = '/tmp/ickapi.pid' +pidfile = 'ickapi.pid' @@ -2,7 +2,6 @@ import setuptools - with open('ickapi/version.py', 'r') as f: exec(f.read()) @@ -31,12 +30,13 @@ setuptools.setup( 'pydocstyle', 'pylint', 'pytest', + 'pytest-aiohttp', ] }, classifiers=[ 'Development Status :: 3 - Alpha', - 'License :: OSI Approved :: ' - + 'GNU General Public License v3 or later (GPLv3+)', + 'License :: OSI Approved :: ' + + 'GNU General Public License v3 or later (GPLv3+)', 'Environment :: Web Environment', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.6', |