Skip to main content

Class for autotests flask python apps

GitHub Workflow Status GitHub Workflow Status GitHub Workflow Status Codacy Badge Codacy Badge

Install

pip install tester_flask

Usage in tests

from flask import Flask
from tester_flask import TestFlask

app = Flask(__name__)


@app.route('/', methods=['GET', 'POST'])
def main_page():
    return "Flask OK"


@app.route('/redirect', methods=['POST'])
def redirect_page():
    return redirect(url_for('main_page'))


class TestFlaskApp(TestFlask):

    def setUp(self):
        super(TestFlaskApp, self).setUp()
        TestFlask.set_up(self, app)

    def test_app(self):
        assert self.simple_view('main_page').status_code == 200
        assert self.param_post('main_page', {'hello': 1}, {'one': 1}).status_code == 200

        response = self.simple_post('redirect_page', {'one': 1}, follow=False)
        assert self.final_url(response) == self.get_url('main_page')

Development

git clone git@github.com:vb64/test.helper.flask.git
cd test.helper.flask

With Python 3

make setup PYTHON_BIN="/path/to/python3
make tests

With Python 2

make setup2 PYTHON_BIN="/path/to/python2
make tests2

Metadata

Release files for tester-flask 1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tester-flask 1.2
File Size Uploaded
tester_flask-1.2.tar.gz 3.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tester-flask 1.2
File Interpreter ABI Platform
tester_flask-1.2-py3-none-any.whl Python 3 none any Details

Total release size: 7.8 kB

Release files / tester_flask-1.2.tar.gz

Download URL tester_flask-1.2.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ed8bfa63472d991abb56c8c112166040729bf609d432eaf37813aa1980b60695
BLAKE2b-256 checksum
How to use checksums
71e103952b87be892522e10ff2fa5f6635c19ca0405124c798a3606f887ea5a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / tester_flask-1.2-py3-none-any.whl

Download URL tester_flask-1.2-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b67378c4be57811d2ca26c0c5acad5f31532b105b6c3291c19125f8fa598a76f
BLAKE2b-256 checksum
How to use checksums
654475ab9751d8fcb55392525942b9e713e141cb0e79d8a45e34dec05eaa56f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

This release

1.2 This release

2 release files

1.1

2 release files

1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page