Provide a fixture of using Webtest 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
Useage
Start writing a PyTest test, and use webtest_flask_fixture 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 tests, but keep in mind that they use an additional fixture mock_site
to use their test site as the site. To test file in the current working directory, just leave that out (as in the above example).
Future
Currently WebTest does not execute JS in place, we would like to also integrate selenium such that a user can apply our PyTest fixture and get a full experience.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for webtest_flask_fixture-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 521974806ff605d1ed7b8a3d0915e52d78c1548b79d159085b7ef4f18fcd87eb |
|
MD5 | 118f1e610e6ca2d43dbde138a773ed13 |
|
BLAKE2b-256 | fec2390d400175f577c1c10ecb8c0e027c1f9693d909494432d155782657434d |
Hashes for webtest_flask_fixture-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61ab7e47a7fee406c65334cf273d06b5fa554af64214a18b7072ca955a3d2614 |
|
MD5 | 7bcb58bbd6ae8efc839b5b76b134341d |
|
BLAKE2b-256 | 1db81a4cecedaa540cdb2667a7710c53363b9ad2bc22e35e8e094e8c7a857324 |