-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a quick test of our chartblock overrides
- Loading branch information
1 parent
390a82b
commit 9c16139
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |