Skip to content

Commit

Permalink
format python files
Browse files Browse the repository at this point in the history
  • Loading branch information
LB Johnston committed Feb 12, 2022
1 parent 34e7ef2 commit b21c17e
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 28 deletions.
Expand Up @@ -8,20 +8,30 @@
class Migration(migrations.Migration):

dependencies = [
('wagtailcore', '0066_collection_management_permissions'),
('wagtail_hallo_test', '0001_initial'),
("wagtailcore", "0066_collection_management_permissions"),
("wagtail_hallo_test", "0001_initial"),
]

operations = [
migrations.CreateModel(
name='RichTextFieldWithFeaturesPage',
name="RichTextFieldWithFeaturesPage",
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
('body', wagtail.core.fields.RichTextField()),
(
"page_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="wagtailcore.page",
),
),
("body", wagtail.core.fields.RichTextField()),
],
options={
'abstract': False,
"abstract": False,
},
bases=('wagtailcore.page',),
bases=("wagtailcore.page",),
),
]
9 changes: 5 additions & 4 deletions wagtail_hallo/test/models.py
Expand Up @@ -21,11 +21,12 @@ class HalloTestPage(Page):
]



class RichTextFieldWithFeaturesPage(Page):
body = RichTextField(editor="hallo",features=['quotation', 'embed', 'made-up-feature'])
body = RichTextField(
editor="hallo", features=["quotation", "embed", "made-up-feature"]
)

content_panels = [
FieldPanel('title', classname="full title"),
FieldPanel('body'),
FieldPanel("title", classname="full title"),
FieldPanel("body"),
]
18 changes: 11 additions & 7 deletions wagtail_hallo/test/tests/test_hallo.py
Expand Up @@ -71,9 +71,7 @@ def test_default_editor_in_rich_text_field(self):
self.assertContains(response, 'makeHalloRichTextEditable("id_body",')

# check that media for the default hallo features (but not others) is being imported
self.assertContains(
response, "js/hallo-plugins/hallo-wagtaildoclink.js"
)
self.assertContains(response, "js/hallo-plugins/hallo-wagtaildoclink.js")
self.assertNotContains(response, "testapp/js/hallo-blockquote.js")


Expand Down Expand Up @@ -272,7 +270,6 @@ def test_custom_editor_in_rich_text_block(self):
)



class TestHalloJsWithFeaturesKwarg(BaseRichTextEditHandlerTestCase, TestUtils):
def setUp(self):
super().setUp()
Expand All @@ -286,7 +283,11 @@ def test_features_list_on_rich_text_field(self):
response = self.client.get(
reverse(
"wagtailadmin_pages:add",
args=("wagtail_hallo_test", "richtextfieldwithfeaturespage", self.root_page.id),
args=(
"wagtail_hallo_test",
"richtextfieldwithfeaturespage",
self.root_page.id,
),
)
)

Expand Down Expand Up @@ -330,7 +331,6 @@ def test_features_list_on_rich_text_block(self):
)



@override_settings(
WAGTAILADMIN_RICH_TEXT_EDITORS={
"hallo": {
Expand Down Expand Up @@ -370,7 +370,11 @@ def test_custom_features_option_on_rich_text_field(self):
response = self.client.get(
reverse(
"wagtailadmin_pages:add",
args=("wagtail_hallo_test", "richtextfieldwithfeaturespage", self.root_page.id),
args=(
"wagtail_hallo_test",
"richtextfieldwithfeaturespage",
self.root_page.id,
),
)
)
self.assertEqual(response.status_code, 200)
Expand Down
8 changes: 4 additions & 4 deletions wagtail_hallo/test/urls.py
Expand Up @@ -6,8 +6,8 @@
from wagtail.core import urls as wagtail_urls

urlpatterns = [
path('django-admin/', admin.site.urls),
path('admin/', include(wagtailadmin_urls)),
path('documents/', include(wagtaildocs_urls)),
path('', include(wagtail_urls)),
path("django-admin/", admin.site.urls),
path("admin/", include(wagtailadmin_urls)),
path("documents/", include(wagtaildocs_urls)),
path("", include(wagtail_urls)),
]
14 changes: 8 additions & 6 deletions wagtail_hallo/test/wagtail_hooks.py
Expand Up @@ -3,12 +3,14 @@


# register 'quotation' as a rich text feature supported by a hallo.js plugin
@hooks.register('register_rich_text_features')
@hooks.register("register_rich_text_features")
def register_quotation_feature(features):
features.register_editor_plugin(
'hallo', 'quotation', HalloPlugin(
name='halloquotation',
js=['testapp/js/hallo-quotation.js'],
css={'all': ['testapp/css/hallo-quotation.css']},
)
"hallo",
"quotation",
HalloPlugin(
name="halloquotation",
js=["testapp/js/hallo-quotation.js"],
css={"all": ["testapp/css/hallo-quotation.css"]},
),
)

0 comments on commit b21c17e

Please sign in to comment.