def hello_world():\n",
+ " print("hello world!")\n",
+ "
\n",
+ "\n"
+ ]
+ }
+ ],
+ "source": [
+ "print(highlight(code, PythonLexer(), HtmlFormatter()))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "d7e03653",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Django Shell-Plus",
+ "language": "python",
+ "name": "django_extensions"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.11.1"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
diff --git a/pyproject.toml b/pyproject.toml
index c4b54d07..c009474b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -46,10 +46,10 @@ dependencies = [
"django-model-utils",
"django-tag-parser",
"django-threadedcomments",
- "django-watson",
"feedparser",
"markdown",
"plotly",
+ "Pygments",
"python-akismet",
"python-slugify",
"wagtail",
diff --git a/tests/conftest.py b/tests/conftest.py
index 1063755a..027c5668 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -2,25 +2,20 @@
import json
import os
import shutil
-
from copy import deepcopy
from datetime import datetime
-from pathlib import Path
+import pytest
+import pytz
from django.conf import settings
from django.contrib.auth.models import Group
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test.client import RequestFactory
from django.utils import timezone
-
-from wagtail.core.models import Site
-from wagtail.images.models import Image
-
-import pytest
-import pytz
-
from django_comments import get_model as get_comments_model
from rest_framework.test import APIClient
+from wagtail.core.models import Site
+from wagtail.images.models import Image
from cast import appsettings
from cast.models import Audio, ChapterMark, File, ItunesArtWork, Video
@@ -466,6 +461,19 @@ def podcast_episode(blog, audio, body):
)
+@pytest.fixture()
+def podcast_episode_with_same_audio(blog, audio, body):
+ return PostFactory(
+ owner=blog.owner,
+ parent=blog,
+ title="test podcast episode 2",
+ slug="test-podcast-entry2",
+ pub_date=timezone.now(),
+ podcast_audio=audio,
+ body=body,
+ )
+
+
@pytest.fixture()
def podcast_episode_with_different_visible_date(blog, audio):
visible_date = pytz.timezone("Europe/Berlin").localize(datetime(2019, 1, 1, 8))
@@ -596,18 +604,3 @@ def comment_spam(post):
)
instance.save()
return instance
-
-
-@pytest.fixture()
-def access_log_path(fixture_dir):
- return Path(fixture_dir) / "access.log"
-
-
-@pytest.fixture()
-def last_request_dummy():
- class RequestDummy:
- def __init__(self):
- self.timestamp = datetime.strptime("01/Dec/2018:06:55:44 +0100", "%d/%b/%Y:%H:%M:%S %z")
- self.ip = "79.230.47.221"
-
- return RequestDummy()
diff --git a/tests/test_access_log.py b/tests/test_access_log.py
deleted file mode 100644
index 7392548e..00000000
--- a/tests/test_access_log.py
+++ /dev/null
@@ -1,12 +0,0 @@
-# from cast.access_log import get_last_request_position
-# from cast.access_log import get_dataframe_from_position
-
-
-# class TestParseAccesslog:
-# def test_get_access_log_position(self, access_log_path, last_request_dummy):
-# position = get_last_request_position(access_log_path, last_request_dummy)
-# assert position == 4
-#
-# def test_get_df_from_access_log(self, access_log_path):
-# df = get_dataframe_from_position(access_log_path)
-# assert df.shape == (5, 9)
diff --git a/tests/test_api.py b/tests/test_api.py
index cdfdea77..46923b5e 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -5,10 +5,6 @@
from .factories import UserFactory
-# from cast.access_log import pandas_rows_to_dict
-# from cast.access_log import get_last_request_position
-# from cast.access_log import get_dataframe_from_position
-
def test_api_root(api_client):
"""Test that the API root returns a 200."""
@@ -18,12 +14,13 @@ def test_api_root(api_client):
class TestBlogVideo:
+ pytestmark = pytest.mark.django_db
+
@classmethod
def setup_class(cls):
cls.list_url = reverse("cast:api:video_list")
cls.detail_url = reverse("cast:api:video_detail", kwargs={"pk": 1})
- @pytest.mark.django_db
def test_video_list_endpoint_without_authentication(self, api_client):
"""Check for not authenticated status code if trying to access the list
endpoint without being authenticated.
@@ -31,7 +28,6 @@ def test_video_list_endpoint_without_authentication(self, api_client):
r = api_client.get(self.list_url, format="json")
assert r.status_code == 403
- @pytest.mark.django_db
def test_video_detail_endpoint_without_authentication(self, api_client):
"""Check for not authenticated status code if trying to access the
detail endpoint without being authenticated.
@@ -39,7 +35,6 @@ def test_video_detail_endpoint_without_authentication(self, api_client):
r = api_client.get(self.detail_url, format="json")
assert r.status_code == 403
- @pytest.mark.django_db
def test_video_list_endpoint_with_authentication(self, api_client):
"""Check for list result when accessing the list endpoint
being logged in.
@@ -53,12 +48,13 @@ def test_video_list_endpoint_with_authentication(self, api_client):
class TestBlogAudio:
+ pytestmark = pytest.mark.django_db
+
@classmethod
def setup_class(cls):
cls.list_url = reverse("cast:api:audio_list")
cls.detail_url = reverse("cast:api:audio_detail", kwargs={"pk": 1})
- @pytest.mark.django_db
def test_audio_list_endpoint_without_authentication(self, api_client):
"""Check for not authenticated status code if trying to access the list
endpoint without being authenticated.
@@ -66,7 +62,6 @@ def test_audio_list_endpoint_without_authentication(self, api_client):
r = api_client.get(self.list_url, format="json")
assert r.status_code == 403
- @pytest.mark.django_db
def test_audio_detail_endpoint_without_authentication(self, api_client):
"""Check for not authenticated status code if trying to access the
detail endpoint without being authenticated.
@@ -74,7 +69,6 @@ def test_audio_detail_endpoint_without_authentication(self, api_client):
r = api_client.get(self.detail_url, format="json")
assert r.status_code == 403
- @pytest.mark.django_db
def test_audio_list_endpoint_with_authentication(self, api_client):
"""Check for list result when accessing the list endpoint
being logged in.
@@ -88,14 +82,14 @@ def test_audio_list_endpoint_with_authentication(self, api_client):
class TestPodcastAudio:
- @pytest.mark.django_db
+ pytestmark = pytest.mark.django_db
+
def test_podlove_detail_endpoint_without_authentication(self, api_client, audio):
"""Should be accessible without authentication."""
podlove_detail_url = reverse("cast:api:audio_podlove_detail", kwargs={"pk": audio.pk})
r = api_client.get(podlove_detail_url, format="json")
assert r.status_code == 200
- @pytest.mark.django_db
def test_podlove_detail_endpoint_duration(self, api_client, audio):
"""Test whether microseconds get stripped away from duration via api - they have
to be for podlove player to work.
@@ -108,7 +102,27 @@ def test_podlove_detail_endpoint_duration(self, api_client, audio):
r = api_client.get(podlove_detail_url, format="json")
assert "." not in r.json()["duration"]
- @pytest.mark.django_db
+ def test_podlove_detail_endpoint_includes_link_to_episode(self, api_client, podcast_episode):
+ """Test whether the podlove detail endpoint includes a link to the episode."""
+ audio = podcast_episode.podcast_audio
+ podlove_detail_url = reverse("cast:api:audio_podlove_detail", kwargs={"pk": audio.pk})
+
+ r = api_client.get(podlove_detail_url, format="json")
+ assert r.status_code == 200
+
+ # link is always included, might be empty
+ assert "link" in r.json()
+
+ # explicitly set episode_id FIXME: only works if there are multiple episodes for audio
+ podlove_detail_url_with_episode_id = f"{podlove_detail_url}?episode_id={podcast_episode.pk}"
+
+ r = api_client.get(podlove_detail_url_with_episode_id, format="json")
+ assert r.status_code == 200
+
+ podlove_data = r.json()
+ assert "link" in podlove_data
+ assert podlove_data["link"] == podcast_episode.full_url
+
def test_podlove_detail_endpoint_chaptermarks(self, api_client, audio, chaptermarks):
"""Test whether chaptermarks get delivered via podlove endpoint."""
print("chaptermarks: ", chaptermarks)
@@ -124,42 +138,18 @@ def test_podlove_detail_endpoint_chaptermarks(self, api_client, audio, chapterma
assert chapters[-1]["title"] == "coughing"
-class TestRequest:
- @classmethod
- def setup_class(cls):
- cls.list_url = reverse("cast:api:request_list")
-
- @pytest.mark.django_db
- def test_request_list_endpoint_without_authentication(self, api_client):
- """Should not be accessible without authentication."""
- r = api_client.get(self.list_url, format="json")
- assert r.status_code == 403
-
- @pytest.mark.django_db
- def test_request_list_endpoint_with_authentication(self, api_client):
- """Check for list result when accessing the list endpoint
- being logged in.
- """
- user = UserFactory()
- api_client.login(username=user.username, password="password")
- r = api_client.get(self.list_url, format="json")
- # dont redirect to login page
- assert r.status_code == 200
- assert "results" in r.json()
-
-
class TestCommentTrainingData:
+ pytestmark = pytest.mark.django_db
+
@classmethod
def setup_class(cls):
cls.url = reverse("cast:api:comment-training-data")
- @pytest.mark.django_db
def test_get_comment_training_data_without_authentication(self, api_client):
"""Should not be accessible without authentication."""
r = api_client.get(self.url, format="json")
assert r.status_code == 403
- @pytest.mark.django_db
def test_get_comment_training_data_with_authentication(self, api_client):
"""Check for list result when accessing the training data endpoint being logged in."""
user = UserFactory()
@@ -167,61 +157,3 @@ def test_get_comment_training_data_with_authentication(self, api_client):
r = api_client.get(self.url, format="json")
assert r.status_code == 200
assert r.json() == []
-
-
-# @pytest.mark.django_db
-# def test_request_list_endpoint_non_bulk_insert(self, api_client, access_log_path):
-# user = UserFactory()
-# api_client.login(username=user.username, password="password")
-# df = get_dataframe_from_position(access_log_path, start_position=0)
-# raw_rows = df.fillna("").to_dict(orient="rows")
-# rows = pandas_rows_to_dict(raw_rows)
-# row = rows[0]
-# r = api_client.post(self.list_url, data=row, format="json")
-# assert r.status_code == 201
-
-# @pytest.mark.django_db
-# def test_request_list_endpoint_bulk_insert(self, api_client, access_log_path):
-# user = UserFactory()
-# api_client.login(username=user.username, password="password")
-# df = get_dataframe_from_position(access_log_path, start_position=0)
-# raw_rows = df.fillna("").to_dict(orient="rows")
-# rows = pandas_rows_to_dict(raw_rows)
-# r = api_client.post(self.list_url, data=rows, format="json")
-# assert r.status_code == 201
-# assert Request.objects.count() == df.shape[0]
-
-# @pytest.mark.django_db
-# def test_request_list_endpoint_incremental_insert(
-# self, api_client, access_log_path
-# ):
-# user = UserFactory()
-# api_client.login(username=user.username, password="password")
-# Request.objects.all().delete()
-#
-# # insert just first row
-# df = get_dataframe_from_position(access_log_path, start_position=0)
-# raw_rows = df.fillna("").to_dict(orient="rows")
-# rows = pandas_rows_to_dict(raw_rows)
-# row = rows[0]
-# r = api_client.post(self.list_url, data=row, format="json")
-# assert r.status_code == 201
-#
-# # get last position (should be 4 because first 5 are the same)
-# last_request = Request.objects.all().order_by("-timestamp")[0]
-# last_position = get_last_request_position(access_log_path, last_request)
-# assert last_position == 4
-#
-# # insert starting at position 4
-# df = get_dataframe_from_position(access_log_path, start_position=last_position)
-# raw_rows = df.fillna("").to_dict(orient="rows")
-# rows = pandas_rows_to_dict(raw_rows)
-# r = api_client.post(self.list_url, data=rows, format="json")
-# assert r.status_code == 201
-#
-# # assert number of unique lines in access.log and objects in database are equal
-# # we omitted some lines intentionally
-# number_of_unique_lines = 0
-# with open(access_log_path) as f:
-# number_of_unique_lines = len(set([l for l in f]))
-# assert Request.objects.count() == number_of_unique_lines
diff --git a/tests/test_dashboard.py b/tests/test_dashboard.py
deleted file mode 100644
index d6dc7939..00000000
--- a/tests/test_dashboard.py
+++ /dev/null
@@ -1,26 +0,0 @@
-from django.urls import reverse
-
-import pytest
-
-from .factories import UserFactory
-
-
-class TestDashboard:
- pytestmark = pytest.mark.django_db
-
- @classmethod
- def setup_class(cls):
- cls.dashboard_url = reverse("cast:dashboard")
-
- def test_get_dashboard_without_authentication(self, client):
- r = client.get(self.dashboard_url)
- # redirect to login page
- assert r.status_code == 302
-
- def test_get_dashboard_with_authentication(self, client):
- user = UserFactory()
- client.login(username=user.username, password="password")
- r = client.get(self.dashboard_url)
- # dont redirect to login page
- assert r.status_code == 200
- assert "Dashboard" in r.content.decode("utf8")
diff --git a/tests/test_feed.py b/tests/test_feed.py
index 1164d51d..96722804 100644
--- a/tests/test_feed.py
+++ b/tests/test_feed.py
@@ -11,8 +11,15 @@
from cast.models import Post
+def test_unknown_audio_format():
+ pf = PodcastFeed()
+ with pytest.raises(Http404):
+ pf.set_audio_format("foobar")
+
+
class TestFeedCreation:
- @pytest.mark.django_db
+ pytestmark = pytest.mark.django_db
+
def test_add_artwork_true(self, dummy_handler, blog_with_artwork):
ie = ITunesElements()
ie.feed = {"title": "foobar", "link": "bar"}
@@ -21,7 +28,6 @@ def test_add_artwork_true(self, dummy_handler, blog_with_artwork):
assert "image" in dummy_handler.se
assert "image" in dummy_handler.ee
- @pytest.mark.django_db
def test_add_artwork_false(self, dummy_handler, blog):
ie = ITunesElements()
ie.feed = {"title": "foobar", "link": "bar"}
@@ -30,12 +36,6 @@ def test_add_artwork_false(self, dummy_handler, blog):
assert "image" not in dummy_handler.se
assert "image" not in dummy_handler.ee
- def test_unknown_audio_format(self):
- pf = PodcastFeed()
- with pytest.raises(Http404):
- pf.set_audio_format("foobar")
-
- @pytest.mark.django_db
def test_itunes_categories(self, dummy_handler, blog_with_itunes_categories):
blog = blog_with_itunes_categories
ie = ITunesElements()
@@ -55,7 +55,8 @@ def use_dummy_cache_backend(settings):
class TestGeneratedFeeds:
- @pytest.mark.django_db
+ pytestmark = pytest.mark.django_db
+
def test_get_latest_entries_feed(self, client, post, use_dummy_cache_backend):
feed_url = reverse("cast:latest_entries_feed", kwargs={"slug": post.blog.slug})
@@ -66,7 +67,6 @@ def test_get_latest_entries_feed(self, client, post, use_dummy_cache_backend):
assert "xml" in content
assert post.title in content
- @pytest.mark.django_db
def test_get_podcast_m4a_feed_rss(self, client, podcast_episode, use_dummy_cache_backend):
feed_url = reverse(
"cast:podcast_feed_rss",
@@ -80,7 +80,6 @@ def test_get_podcast_m4a_feed_rss(self, client, podcast_episode, use_dummy_cache
assert "rss" in content
assert podcast_episode.title in content
- @pytest.mark.django_db
def test_get_podcast_m4a_feed_atom(self, client, podcast_episode):
feed_url = reverse(
"cast:podcast_feed_atom",
@@ -94,7 +93,6 @@ def test_get_podcast_m4a_feed_atom(self, client, podcast_episode):
assert "feed" in content
assert podcast_episode.title in content
- @pytest.mark.django_db
def test_podcast_feed_contains_only_podcasts(self, client, post, podcast_episode, use_dummy_cache_backend):
feed_url = reverse(
"cast:podcast_feed_rss",
@@ -107,7 +105,6 @@ def test_podcast_feed_contains_only_podcasts(self, client, post, podcast_episode
assert len(d.entries) == 1
assert Post.objects.live().descendant_of(podcast_episode.blog).count() == 2
- @pytest.mark.django_db
def test_podcast_feed_contains_visible_date_as_pubdate(
self, client, podcast_episode_with_different_visible_date, use_dummy_cache_backend
):
@@ -125,7 +122,6 @@ def test_podcast_feed_contains_visible_date_as_pubdate(
date_from_feed = pytz.utc.localize(date_from_feed)
assert date_from_feed == podcast_episode.visible_date
- @pytest.mark.django_db
def test_podcast_feed_contains_detail_information(self, client, podcast_episode):
feed_url = reverse(
"cast:podcast_feed_rss",
diff --git a/tests/test_models.py b/tests/test_models.py
index 9e64710b..c2e0614f 100644
--- a/tests/test_models.py
+++ b/tests/test_models.py
@@ -6,17 +6,16 @@
class TestVideoModel:
- @pytest.mark.django_db
+ pytestmark = pytest.mark.django_db
+
def test_get_all_video_paths(self, video):
all_paths = list(video.get_all_paths())
assert len(all_paths) == 1
- @pytest.mark.django_db
def test_get_all_video_paths_with_poster(self, video_with_poster):
all_paths = list(video_with_poster.get_all_paths())
assert len(all_paths) == 2
- @pytest.mark.django_db
def test_get_all_video_paths_without_thumbnail(self, video):
class Dummy:
name = "foobar"
@@ -49,51 +48,72 @@ def test_get_image_ids(self, gallery):
class TestAudioModel:
- @pytest.mark.django_db
+ pytestmark = pytest.mark.django_db
+
def test_get_file_formats(self, audio):
assert audio.file_formats == "m4a"
- @pytest.mark.django_db
def test_get_file_names(self, audio):
assert "test" in audio.get_audio_file_names()
- @pytest.mark.django_db
def test_get_name(self, audio):
audio.title = None # make sure name is provided by file
assert audio.name == "test"
- @pytest.mark.django_db
def test_get_name_with_title(self, audio):
title = "foobar"
audio.title = title
assert audio.name == title
- @pytest.mark.django_db
def test_audio_str(self, audio):
audio.title = None # make sure name is provided by file
assert "1 - test" == str(audio)
- @pytest.mark.django_db
def test_audio_get_all_paths(self, audio):
assert "cast_audio/test.m4a" in audio.get_all_paths()
- @pytest.mark.django_db
def test_audio_duration(self, audio):
duration = audio._get_audio_duration(audio.m4a.path)
assert duration == timedelta(microseconds=700000)
- @pytest.mark.django_db
def test_audio_create_duration(self, audio):
duration = "00:01:01.00"
audio._get_audio_duration = lambda x: duration
audio.create_duration()
assert audio.duration == duration
- @pytest.mark.django_db
def test_audio_podlove_url(self, audio):
assert audio.podlove_url == "/cast/api/audios/podlove/1"
- @pytest.mark.django_db
+ def test_get_episode_url_from_audio(self, podcast_episode):
+ audio = podcast_episode.podcast_audio
+
+ # happy path - audio has episode and episode_id is set
+ audio.set_episode_id(podcast_episode.pk)
+ assert "http" in audio.episode_url
+
+ # happy path - audio is only used by one episode
+ del audio._episode_id
+ assert "http" in audio.episode_url
+
+ # sad path - audio is not used by any episode
+ podcast_episode.podcast_audio = None
+ podcast_episode.save()
+ assert audio.episode_url is None
+
+ def test_get_episode_url_from_audio_with_multiple_episodes(self, podcast_episode, podcast_episode_with_same_audio):
+ audio = podcast_episode.podcast_audio
+
+ # sad path - audio is used by multiple episodes
+ assert audio.episode_url is None
+
+ # happy path - audio is used by multiple episodes but episode_id is set
+ audio.set_episode_id(podcast_episode.pk)
+ assert audio.episode_url == podcast_episode.full_url
+
+ audio.set_episode_id(podcast_episode_with_same_audio.pk)
+ assert audio.episode_url == podcast_episode_with_same_audio.full_url
+
def test_audio_get_chaptermark_data_from_file_empty_on_value_error(self, audio):
assert audio.get_chaptermark_data_from_file("mp3") == []
@@ -146,54 +166,48 @@ def test_get_all_file_paths(self, file_instance):
class TestBlogModel:
- @pytest.mark.django_db
+ pytestmark = pytest.mark.django_db
+
def test_blog_str(self, blog):
assert blog.title == str(blog)
- @pytest.mark.django_db
def test_blog_author_null(self, blog):
blog.author = None
assert blog.author_name == blog.owner.get_full_name()
- @pytest.mark.django_db
def test_blog_author_not_null(self, blog):
blog.author = "Foobar"
assert blog.author_name == blog.author
class TestPostModel:
- @pytest.mark.django_db
+ pytestmark = pytest.mark.django_db
+
def test_post_slug(self, post):
assert post.get_slug() == "test-entry"
- @pytest.mark.django_db
def test_post_has_audio(self, post):
assert post.has_audio is False
- @pytest.mark.django_db
def test_post_has_audio_true(self, post, audio):
post.podcast_audio = audio
assert post.has_audio is True
- @pytest.mark.django_db
def test_post_comments_enabled(self, post, comments_enabled):
post.comments_enabled = True
post.blog.comments_enabled = True
assert post.comments_are_enabled
- @pytest.mark.django_db
def test_post_comments_disabled_settings(self, post, comments_not_enabled):
post.comments_enabled = True
post.blog.comments_enabled = True
assert not post.comments_are_enabled
- @pytest.mark.django_db
def test_post_comments_disabled_blog(self, post, comments_enabled):
post.comments_enabled = True
post.blog.comments_enabled = False
assert not post.comments_are_enabled
- @pytest.mark.django_db
def test_post_comments_disabled_post(self, post, comments_enabled):
post.comments_enabled = False
post.blog.comments_enabled = True
diff --git a/tests/test_post_add.py b/tests/test_post_add.py
index 33fed8f6..e4cf6f3d 100644
--- a/tests/test_post_add.py
+++ b/tests/test_post_add.py
@@ -11,7 +11,7 @@ def test_get_add_form_post_not_authenticated(self, client, blog):
add_url = reverse("wagtailadmin_pages:add_subpage", args=(blog.id,))
r = client.get(add_url)
- # redirect to login
+ # redirect to log in
assert r.status_code == 302
login_url = reverse("wagtailadmin_login")
assert login_url in r.url
@@ -86,7 +86,7 @@ def test_submit_add_form_post_authenticated_with_video(self, client, post_data_w
# make sure there was a post added to the database
assert post.title == post_data_wagtail["title"]
- # make sure there was an video added
+ # make sure there was a video added
assert post.videos.count() == 1
assert post.videos.first() == video
@@ -112,7 +112,30 @@ def test_submit_add_form_post_authenticated_with_gallery(self, client, post_data
# make sure there was a post added to the database
assert post.title == post_data_wagtail["title"]
- # make sure there was an gallery added
+ # make sure there was a gallery added
assert post.galleries.count() == 1
assert post.galleries.first() == gallery
assert list(post.galleries.first().images.all()) == list(gallery.images.all())
+
+ def test_submit_add_form_post_authenticated_with_code(self, client, post_data_wagtail, blog, video):
+ _ = client.login(username=blog.owner.username, password=blog.owner._password)
+ add_url = reverse("wagtailadmin_pages:add", args=("cast", "post", blog.id))
+ post_data_wagtail["body-0-value-0-type"] = "code"
+ post_data_wagtail["body-0-value-0-value-language"] = "python"
+ post_data_wagtail["body-0-value-0-value-source"] = 'def hello_world():\n print("Hello World!")'
+
+ r = client.post(add_url, post_data_wagtail)
+
+ # make sure we are redirected to blog index
+ assert r.status_code == 302
+ assert r.url == reverse("wagtailadmin_explore", args=(blog.id,))
+
+ post = Post.objects.get(slug=post_data_wagtail["slug"])
+
+ # make sure there was a post added to the database
+ assert post.title == post_data_wagtail["title"]
+
+ # make sure there was a code block added
+ assert post.body.raw_data[0]["value"][0]["value"]["language"] == "python"
+ assert "hello_world" in post.body.raw_data[0]["value"][0]["value"]["source"]
+ assert "highlight" in str(post.body)