diff --git a/.gitignore b/.gitignore index 15aa657e..1cdbb422 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ /charts/*/requirements.lock # Build & test artifacts +/.cache /.eggs /.helm-pid /.tox diff --git a/etc/promenade/noauth-api-paste.ini b/etc/promenade/noauth-api-paste.ini index d8ef0b84..3f034bd6 100644 --- a/etc/promenade/noauth-api-paste.ini +++ b/etc/promenade/noauth-api-paste.ini @@ -17,7 +17,7 @@ [filter:noauth] forged_roles = admin -paste.filter_factory = promenade.control.middleware:no_auth_filter_factory +paste.filter_factory = promenade.control.middleware:noauth_filter_factory [app:promenade-api] disable = keystone diff --git a/test-requirements.txt b/test-requirements.txt index f90a632e..e079f8a6 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,4 +1 @@ -# Documentation pytest -sphinx>=1.6.2 -sphinx_rtd_theme==0.2.4 diff --git a/tests/unit/api/test_health_api.py b/tests/unit/api/test_health_api.py index 78dd6cbb..32b2bf1f 100644 --- a/tests/unit/api/test_health_api.py +++ b/tests/unit/api/test_health_api.py @@ -1,3 +1,17 @@ +# Copyright 2017 AT&T Intellectual Property. All other rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import falcon from falcon import testing import pytest @@ -10,6 +24,7 @@ from promenade.promenade import promenade def client(): return testing.TestClient(promenade) + def test_get_health(client): response = client.simulate_get('/api/v1.0/health') assert response.status == falcon.HTTP_204 diff --git a/tests/unit/api/test_versions.py b/tests/unit/api/test_versions.py index 59070cba..00d0c071 100644 --- a/tests/unit/api/test_versions.py +++ b/tests/unit/api/test_versions.py @@ -1,3 +1,17 @@ +# Copyright 2017 AT&T Intellectual Property. All other rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import falcon from falcon import testing import pytest @@ -10,9 +24,8 @@ from promenade.promenade import promenade def client(): return testing.TestClient(promenade) + def test_get_versions(client): response = client.simulate_get('/versions') assert response.status == falcon.HTTP_200 - body = response.content.decode('utf-8') - assert '"path": "/api/v1.0"' in body - assert '"status": "stable"' in body + assert response.json == {'v1.0': {'path': '/api/v1.0', 'status': 'stable'}} diff --git a/tox.ini b/tox.ini index 5a44b625..03ecf7e7 100644 --- a/tox.ini +++ b/tox.ini @@ -1,18 +1,13 @@ [tox] -envlist = py35,unit,bandit,lint,docs - -[testenv] -setenv= - PYTHONWARNING=all -commands= - pytest \ - {posargs} -deps = -r{toxinidir}/requirements-frozen.txt - -r{toxinidir}/test-requirements.txt +envlist = lint,unit,bandit,docs [testenv:unit] +setenv = + PYTHONWARNING=all +deps = -r{toxinidir}/requirements-frozen.txt + -r{toxinidir}/test-requirements.txt commands = - pytest tests/unit + pytest [testenv:bandit] deps = bandit==1.4.0 @@ -20,7 +15,10 @@ commands = bandit -r promenade [testenv:docs] -whitelist_externals=rm +whitelist_externals = rm +deps = + sphinx>=1.6.2 + sphinx_rtd_theme==0.2.4 commands = rm -rf docs/build python setup.py build_sphinx {posargs} @@ -28,12 +26,12 @@ commands = [testenv:fmt] deps = yapf==0.20.0 commands = - yapf -ir {toxinidir}/promenade + yapf -ir {toxinidir}/promenade {toxinidir}/tests [testenv:freeze] deps = -r{toxinidir}/requirements-direct.txt recreate = True -whitelist_externals=sh +whitelist_externals = sh commands= sh -c "pip freeze | grep -v '^promenade' > {toxinidir}/requirements-frozen.txt" @@ -49,5 +47,5 @@ deps = yapf==0.20.0 flake8==3.5.0 commands = - yapf -rd {toxinidir}/promenade + yapf -rd {toxinidir}/promenade {toxinidir}/tests flake8 {toxinidir}/promenade