Skip to content

Commit

Permalink
Add a quick test of our chartblock overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
willbarton committed Sep 27, 2024
1 parent 390a82b commit 9c16139
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions cfgov/v1/tests/atomic_elements/organisms/test_charts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from django.test import TestCase

from wagtail.models import Site

from v1.atomic_elements.charts import CHART_COLORS, CHART_TYPES, ChartBlock


class ChartBlockTestCase(TestCase):
def setUp(self):
self.root = Site.objects.get(is_default_site=True).root_page

def test_chartblock_overrides(self):
block = ChartBlock()

# We override the chart types and colors
self.assertEqual(block.chart_types, CHART_TYPES)
self.assertEqual(block.meta.colors, CHART_COLORS)

# And we override the child block ordering to ensure these are the
# last three blocks in the editor.
self.assertEqual(list(block.child_blocks.keys())[-1], "settings")
self.assertEqual(list(block.child_blocks.keys())[-2], "datasets")
self.assertEqual(list(block.child_blocks.keys())[-3], "chart_type")

0 comments on commit 9c16139

Please sign in to comment.