mirror of
https://github.com/kennethreitz/responder.git
synced 2026-06-05 14:50:19 +00:00
56 lines
924 B
Python
56 lines
924 B
Python
import responder
|
|
from pathlib import Path
|
|
import pytest
|
|
import multiprocessing
|
|
import concurrent.futures
|
|
|
|
|
|
@pytest.fixture
|
|
def data_dir(current_dir):
|
|
yield current_dir / "data"
|
|
|
|
|
|
@pytest.fixture()
|
|
def current_dir():
|
|
yield Path(__file__).parent
|
|
|
|
|
|
@pytest.fixture
|
|
def api():
|
|
return responder.API(debug=False, allowed_hosts=[";"])
|
|
|
|
|
|
@pytest.fixture
|
|
def session(api):
|
|
return api.requests
|
|
|
|
|
|
@pytest.fixture
|
|
def url():
|
|
def url_for(s):
|
|
return f"http://;{s}"
|
|
|
|
return url_for
|
|
|
|
|
|
@pytest.fixture
|
|
def flask():
|
|
from flask import Flask
|
|
|
|
app = Flask(__name__)
|
|
|
|
@app.route("/")
|
|
def hello():
|
|
return "Hello World!"
|
|
|
|
return app
|
|
|
|
|
|
@pytest.fixture
|
|
def template_path(tmpdir):
|
|
# create a Jinja template file on the filesystem
|
|
template_name = "test.html"
|
|
template_file = tmpdir.mkdir("static").join(template_name)
|
|
template_file.write("{{ var }}")
|
|
return template_file
|