summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Dolgov <ivan@dolgov.fi>2019-04-06 15:17:08 +0300
committerIvan Dolgov <ivan@dolgov.fi>2019-04-06 15:17:08 +0300
commit0146d3488826d82292b91426ea1d0655bfe38a9d (patch)
treed09136f905b1ac54d5660e290537a1cb81e35b53
parentf09185c5c2bc327103a61ca4c9ed2f8ae2916802 (diff)
parentab9c02fd365dde7c4f26ff57898410504e03b895 (diff)
downloadickapi-master.tar.gz
Merge branch 'pyry/apitest'HEADmaster
-rw-r--r--Makefile9
-rw-r--r--apitest/test_version.py13
-rw-r--r--gunicorn.conf2
-rw-r--r--setup.py6
4 files changed, 24 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index e7ec035..1aa1e36 100644
--- a/Makefile
+++ b/Makefile
@@ -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'
diff --git a/setup.py b/setup.py
index 30bf11c..c5f402f 100644
--- a/setup.py
+++ b/setup.py
@@ -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',