Adding unit tests

This commit is contained in:
ClemRiviere
2020-04-15 13:32:50 +02:00
parent 8df80cc5b2
commit 613cf1546a
+15
View File
@@ -4,6 +4,7 @@ from testfixtures import compare
from django import forms
from django.urls import reverse
from django.test import override_settings
from modoboa.lib.tests import ModoTestCase
from modoboa.parameters import forms as param_forms, tools as param_tools
@@ -159,6 +160,20 @@ class DashboardTestCase(ModoTestCase):
response = self.client.get(url)
self.assertNotContains(response, "Features looking for sponsoring")
@override_settings(DISABLE_RSS=False)
def test_enable_rss(self):
"""Load dashboard with DISABLE_RSS = False"""
url = reverse("core:dashboard")
response = self.client.get(url)
self.assertContains(response, 'href="https://modoboa.org/en/weblog/')
@override_settings(DISABLE_RSS=True)
def test_disable_rss(self):
"""Load dashboard with DISABLE_RSS = True"""
url = reverse("core:dashboard")
response = self.client.get(url)
self.assertNotContains(response, 'https://modoboa.org/en/weblog/')
def test_root_dispatch(self):
"""Check root dispatching."""
url = reverse("core:root")