Skip to content

Commit faf1c7f

Browse files
author
Fabien Coelho
committed
better doc
1 parent 77418f8 commit faf1c7f

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

README.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# FlaskTester - fixtures for Flask internal and external pytest tests
1+
# FlaskTester - Pytest fixtures for Flask internal and external tests
22

33
This package allows to run authenticated tests against a Flask application,
44
either with internal Flask tests (aka `test_client`) or external tests (with
@@ -7,6 +7,15 @@ either with internal Flask tests (aka `test_client`) or external tests (with
77
Only one set of tests is needed, switching from internal to external is
88
achieved through environment variables.
99

10+
![Status](https://github.com/zx80/flask-tester/actions/workflows/package.yml/badge.svg?branch=master&style=flat)
11+
![Tests](https://img.shields.io/badge/tests-2%20✓-success)
12+
![Coverage](https://img.shields.io/badge/coverage-0%25-success)
13+
![Issues](https://img.shields.io/github/issues/zx80/flask-tester?style=flat)
14+
![Python](https://img.shields.io/badge/python-3-informational)
15+
![Version](https://img.shields.io/pypi/v/FlaskTester)
16+
![Badges](https://img.shields.io/badge/badges-8-informational)
17+
![License](https://img.shields.io/pypi/l/flasktester?style=flat)
18+
1019
## Fixtures
1120

1221
The package provides two fixtures:
@@ -51,12 +60,16 @@ assigning them through `os.environ`.
5160

5261
## Classes
5362

54-
The implementation of these fixtures is based on four classes:
63+
The implementation of these fixtures is based on five classes:
5564

5665
- `Authenticator` class to store test credentials.
5766

5867
Use `setPass` and `setToken` to add user credentials.
5968

69+
- `RequestFlaskResponse` class to turn a `requests` response into
70+
a Flask-looking response, with the following attributes: `status_code`,
71+
`data`, `text`, `headers`, `cookies`, `is_json` and `json`.
72+
6073
- `Client` abstract class to run test, with two implementations.
6174

6275
The class provides usual `get`, `post`… per-HTTP-method methods,
@@ -69,21 +82,30 @@ The implementation of these fixtures is based on four classes:
6982
otherwise allowed schemes are tried, with tokens first.
7083
- `status` for the expected HTTP status code.
7184

85+
For the check methods, the mandatory parameters are the method, the path
86+
and the expected status.
87+
7288
- `FlaskClient` implementation class for internal tests.
89+
90+
This class is mostly the standard `test_client` with the above parameters
91+
extensions.
92+
7393
- `RequestClient` implementation class for external (real HTTP) tests.
7494

95+
The path is relative to the URL provided to the constructor.
96+
97+
7598
## TODO
7699

77100
- API documentation generation
78101
- coverage tests
79-
- useless but decorative badges
80-
- pypi distribution
81102

82103
## Versions
83104

84105
### 0.10 on ?
85106

86107
Add `FLASK_TESTER_DEFAULT` environment configuration to `ft_client`.
108+
Improve documentation, including incredible badges.
87109

88110
### 0.9 on 2024-03-11
89111

0 commit comments

Comments
 (0)