fastapi/tests/test_tutorial/test_templates/test_tutorial001.py
Sebastián Ramírez 6205935323
Add support for docs translations (#1168)
* 🌐 Refactor file structure to support internationalization

*  Update tests changed after i18n

* 🔀 Merge Typer style from master

* 🔧 Update MkConfig with Typer-styles

* 🎨 Format mkdocs.yml with cannonical form

* 🎨 Format mkdocs.yml

* 🔧 Update MkDocs config

*  Add docs translation scripts dependencies

*  Add Typer scripts to handle translations

*  Add missing translation snippet to include

*  Update contributing docs, add docs for translations

* 🙈 Add docs_build to gitignore

* 🔧 Update scripts with new locations and docs scripts

* 👷 Update docs deploy action with translations

* 📝 Add note about languages not supported in the theme

*  Add first translation, for Spanish
2020-03-26 20:09:53 +01:00

19 lines
615 B
Python

import shutil
from fastapi.testclient import TestClient
def test_main():
shutil.copytree("./docs_src/templates/templates/", "./templates")
shutil.copytree("./docs_src/templates/static/", "./static")
from templates.tutorial001 import app
client = TestClient(app)
response = client.get("/items/foo")
assert response.status_code == 200
assert b"<h1>Item ID: foo</h1>" in response.content
response = client.get("/static/styles.css")
assert response.status_code == 200
assert b"color: green;" in response.content
shutil.rmtree("./templates")
shutil.rmtree("./static")