From 8faf1a0414c98d13b0cbb25188f00746726521d3 Mon Sep 17 00:00:00 2001 From: Demetriex Date: Tue, 20 Apr 2021 00:53:18 +0800 Subject: [PATCH 1/5] organize tests --- setup.cfg | 1 - tests/conftest.py | 10 - tests/macros/__init__.py | 0 tests/macros/test_render_breadcrumb_item.py | 14 + tests/macros/test_render_field.py | 17 + tests/macros/test_render_form.py | 187 ++++++ tests/macros/test_render_form_row.py | 53 ++ tests/macros/test_render_hidden_errors.py | 28 + tests/macros/test_render_icon.py | 71 ++ tests/macros/test_render_messages.py | 56 ++ tests/macros/test_render_nav_item.py | 14 + tests/macros/test_render_pager.py | 39 ++ tests/macros/test_render_pagination.py | 38 ++ tests/macros/test_render_static.py | 0 tests/macros/test_render_table.py | 176 +++++ tests/test_bootstrap.py | 37 +- tests/test_render.py | 680 -------------------- tests/test_themes.py | 51 ++ tox.ini | 2 +- 19 files changed, 753 insertions(+), 721 deletions(-) create mode 100644 tests/macros/__init__.py create mode 100644 tests/macros/test_render_breadcrumb_item.py create mode 100644 tests/macros/test_render_field.py create mode 100644 tests/macros/test_render_form.py create mode 100644 tests/macros/test_render_form_row.py create mode 100644 tests/macros/test_render_hidden_errors.py create mode 100644 tests/macros/test_render_icon.py create mode 100644 tests/macros/test_render_messages.py create mode 100644 tests/macros/test_render_nav_item.py create mode 100644 tests/macros/test_render_pager.py create mode 100644 tests/macros/test_render_pagination.py create mode 100644 tests/macros/test_render_static.py create mode 100644 tests/macros/test_render_table.py delete mode 100644 tests/test_render.py create mode 100644 tests/test_themes.py diff --git a/setup.cfg b/setup.cfg index 445c46c9..3553c74e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -20,5 +20,4 @@ tests_require = pytest test = pytest [tool:pytest] -addopts = --verbose testpaths = tests \ No newline at end of file diff --git a/tests/conftest.py b/tests/conftest.py index ebd09f83..b09e315b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -18,16 +18,6 @@ def hello_form(): return HelloForm -@pytest.fixture -def bootswatch_themes(): - themes = [ - 'cerulean', 'cosmo', 'cyborg', 'darkly', 'default', 'flatly', 'journal', 'litera', - 'lumen', 'lux', 'materia', 'minty', 'pulse', 'sandstone', 'simplex', 'sketchy', 'slate', - 'solar', 'spacelab', 'superhero', 'united', 'yeti' - ] - return themes - - @pytest.fixture(autouse=True) def app(): app = Flask(__name__) diff --git a/tests/macros/__init__.py b/tests/macros/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/macros/test_render_breadcrumb_item.py b/tests/macros/test_render_breadcrumb_item.py new file mode 100644 index 00000000..db27f5df --- /dev/null +++ b/tests/macros/test_render_breadcrumb_item.py @@ -0,0 +1,14 @@ +from flask import render_template_string + + +def test_render_breadcrumb_item(app, client): + @app.route('/breadcrumb_item') + def test(): + return render_template_string(''' + {% from 'bootstrap/nav.html' import render_breadcrumb_item %} + {{ render_breadcrumb_item('test', 'Home') }} + ''') + + response = client.get('/breadcrumb_item') + data = response.get_data(as_text=True) + assert '