def test_valid_token(client): token = Token() token.save() # Try with querystring response = client.get( url_for('mobile_bp.index', token=token.token, _external=False)) assert response.status_code == 200 # Then session response = client.get(url_for('mobile_bp.index', _external=False)) assert response.status_code == 200 token.refresh_from_db() assert token.used is True token.delete_instance() call = Call.get_call() assert call.status == Call.ON_CALL call.delete_instance()