Files
website-v2/core/tests/fixtures.py
daveoconnor c0d453a58f Show asciidocs library docs in iframe (#1369)
Related to ticket #1358, libraries docs iframe

~~This also contains some of the work for refactoring away from version
selects being copy pasted everywhere.~~ Removed for now, had side
effects.
2024-10-18 16:15:58 -07:00

48 lines
1.2 KiB
Python

import pytest
from model_bakery import baker
@pytest.fixture
def rendered_content(db):
return baker.make(
"core.RenderedContent",
cache_key="cache-key",
content_original="Sample content",
content_html="<p>Sample content</p>",
)
@pytest.fixture
def mock_get_file_data(monkeypatch):
def _mock_get_file_data(
content,
content_s3_key,
content_s3_key_prefix="/archives/",
content_type="text/html",
):
def get_file_data(client, bucket_name, s3_key):
if f"{content_s3_key_prefix}{content_s3_key}" == s3_key:
result = {
"content": content,
"content_key": s3_key,
"content_type": content_type,
"last_modified": None,
}
else:
result = None
return result
monkeypatch.setattr("core.boostrenderer.get_file_data", get_file_data)
return _mock_get_file_data
@pytest.fixture
def mock_get_leaf_data():
return open("core/tests/content/leaf.html", "rb").read()
@pytest.fixture
def mock_get_accumulators_data():
return open("core/tests/content/accumulators.html", "rb").read()