Skip to content
Myr

Update documentation to use the getter only once

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Adam Byrtek · committed by Markus Unterwaditzer · parent 1df2788 · Browse files · 1 file+5 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+5 added−3 removed

  • other:+5 added−3 removed

1 file+5 added−3 removed

modified:docs/testing.rst+5 added-3 removed
366 unmodified lines
367 from flask import jsonify368369 @app.route('/api/auth')370 def auth():371 email = request.get_json()['email']372 password = request.get_json()['password']371 json_data = request.get_json()372 email = json_data['email']373 password = json_data['password']374 return jsonify(token=generate_token(email, password))375376 with app.test_client() as c:377 email = 'john@example.com'378 password = 'secret'379 resp = c.post('/api/auth', json={'login': email, 'password': password})380 json_data = resp.get_json()379 assert verify_token(email, resp.get_json()['token'])381 assert verify_token(email, json_data['token'])382383Note that if the ``json`` argument is provided then the test client will put384JSON-serialized data in the request body, and also set the385``Content-Type: application/json`` HTTP header.