I'm learning testing with pytest
and I'm working on a flask application where I'd like to integrate what I'm learning into. How would you test for a success response and maybe also that the data it returns is what is expected?
# sample Flask app - main.py
from flask import Flask
from flask import escape
import json
app = Flask(__name__)
app.route("/")
def some_route():
return {"success": True}, 200, {"Content-Type: application/json"}
Test file
from unittest.mock import Mock
import json
import main
def test_some_route():
assert "success" in main.some_route()[0]