Files
website-v2/core/tests/test_models.py
Lacey Williams Henschel 825dbc019b Cache asciidoc content in db (Part of #394)
- Add RenderedContent model and related helper methods
- Change StaticContentView `get()` logic to try the cache, then the db, then S3
- Change StaticContentView to update db appropriately
- Refactoring for readability/maintainability
2023-06-09 14:43:05 -07:00

20 lines
577 B
Python

from model_bakery import baker
def test_rendered_content_creation(rendered_content):
assert rendered_content.cache_key is not None
def test_rendered_content_save():
content = baker.make(
"core.RenderedContent",
content_original=b"Sample original content",
content_html=b"<p>Sample HTML content</p>",
content_type=b"text/html",
)
content.save()
content.refresh_from_db()
assert isinstance(content.content_original, str)
assert isinstance(content.content_html, str)
assert isinstance(content.content_type, str)