latest changes

This commit is contained in:
Joren de Graaf
2026-10-22 10:32:41 +02:00
parent 5799b542c8
commit 5b986134be
63 changed files with 2412 additions and 77 deletions
+22
View File
@@ -0,0 +1,22 @@
from django.conf import settings
from django.contrib.auth import get_user_model
from django.test import TestCase, override_settings
from django.urls import reverse
@override_settings(MIDDLEWARE=[item for item in settings.MIDDLEWARE if not item.startswith('whitenoise.')],
SECURE_SSL_REDIRECT=False)
class NavigationTests(TestCase):
def setUp(self):
self.user = get_user_model().objects.create_user(username='nav-test', password='test')
self.client.force_login(self.user)
def test_navigation_has_one_tree_and_active_child(self):
response = self.client.get(reverse('groceries:index'))
self.assertEqual(response.status_code, 200)
html = response.content.decode()
self.assertEqual(html.count('id="nav-submenu-food"'), 1)
self.assertIn('href="/groceries/" aria-current="page"', html)
self.assertIn('nav-group--active', html)
for url in ('/daily/', '/health/', '/food/', '/recipes/', '/food/inventory/', '/groceries/'):
self.assertIn(f'href="{url}"', html)