Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
edwoodward committed May 31, 2023
1 parent e69505a commit c525774
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions oxmenus/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import json

from django.test import TestCase
from wagtail.test.utils import WagtailPageTests
from oxmenus.models import Menus


class OXMenuTests(WagtailPageTests, TestCase):
def setUp(self):
oxmenu = Menus(name="What we do",
menu=json.dumps(
[{"id": "07d57c52-5ec0-494e-870f-3e8b6c86aebc", "type": "menu_block", "value": {
"menu_items": [{"id": "c2793dd0-d0d2-4835-ad1a-3431fd435604", "type": "item",
"value": {"label": "About Us", "partial_url": "/about"}},
{"id": "7d5e6a0d-8034-43c5-89b6-2de10f534034", "type": "item",
"value": {"label": "Team", "partial_url": "/team"}},
{"id": "a402ea4e-cef1-4257-adce-cc4cd1be7f5e", "type": "item",
"value": {"label": "Research", "partial_url": "/research"}}]}}]
)
)
oxmenu.save()

def test_all_menus(self):
response = self.client.get('/apps/cms/api/oxmenus/')
self.assertContains(response, 'About Us')
self.assertContains(response, 'Research')

0 comments on commit c525774

Please sign in to comment.