Skip to main content

Provide a pytest fixture of a Webtest app with a local static site via Flask

Project description

webtest-flask-fixture

Providing a fixture for static websites to use WebTest through Flask

Why WebTest?

WebTest provides a great interface for testing websites including button/link and form interactions.

Why Flask?

Flask comes with an extremely light-weight dev server that can server up arbitrary pages (static or coded) relatively easily.

Let's put the two together!!

And this package is born. The objective is to provide a PyTest.fixture that allows for quickly testing static web sites, or through customizing the template, a fixture that can be used to test more complex web sites.

Installation

pip install webtest-flask-fixture

or, from source:

pip install git+git://github.com/mshafer1/webtest-flask-fixture.git@0.5.1

Useage

Start writing a PyTest test, and use webtest_flask_fixture.test_app to load pages.

Example:

from webtest_flask_fixture import test_app

def test_can_load_test_index(test_app):
    # Act
    resp = test_app.get('/')

    # Assert
    assert resp.status_int == 200
    assert resp.content_type == 'text/html'
    assert 'Hello, World!' in resp  # string must be present in body

More examples in examples.

Future

Currently WebTest does not execute JS in the page, we would like to also integrate selenium such that a user can apply our PyTest fixture and get a full experience.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for webtest-flask-fixture, version 0.5.1
Filename, size File type Python version Upload date Hashes
Filename, size webtest_flask_fixture-0.5.1-py3-none-any.whl (4.6 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size webtest_flask_fixture-0.5.1.tar.gz (4.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page