Add tests for server-example. Fixes #18.

Add tests for server
This commit is contained in:
Brian Quinlan
2020-06-29 14:44:19 -07:00
committed by GitHub
3 changed files with 39 additions and 3 deletions

View File

@@ -22,6 +22,7 @@ def _run_tests(session):
'py.test',
'--quiet',
'tests',
'server-example',
*session.posargs
)
@@ -33,24 +34,27 @@ def lint(session):
serious code quality issues.
"""
session.install('flake8')
session.run('flake8',
'pypadges,tests')
session.run('flake8', 'pybadges')
session.run('flake8', 'tests')
session.run('flake8', 'server-example')
@nox.session
def unit(session):
"""Run the unit test suite."""
session.install('-e', '.[dev]')
session.install('-r', 'server-example/requirements-test.txt')
_run_tests(session)
@nox.session(python=['3.4', '3.5', '3.6', '3.7'])
@nox.session(python=['3.4', '3.5', '3.6', '3.7', '3.8'])
@nox.parametrize('install',
['Jinja2==2.9.0', 'Pillow==5.0.0', 'requests==2.9.0', 'xmldiff==2.4'])
def compatibility(session, install):
"""Run the unit test suite with each support library and Python version."""
session.install('-e', '.[dev]')
session.install('-r', 'server-example/requirements-test.txt')
session.install(install)
_run_tests(session)

View File

@@ -0,0 +1,2 @@
-r requirements.txt
pytest

View File

@@ -0,0 +1,30 @@
# Copyright 2020 The pybadge Authors
#
# 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
#
# https://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.
"Tests for app"
import pytest
import app
@pytest.fixture
def client():
with app.app.test_client() as client:
yield client
def test_image(client):
rv = client.get("/")
assert b'build' in rv.data
assert b'passing' in rv.data