Unit test added.

see #883
This commit is contained in:
Antoine Nguyen
2016-06-06 17:17:47 +02:00
parent 55c6678f53
commit a8f311501a
2 changed files with 18 additions and 0 deletions
+16
View File
@@ -146,3 +146,19 @@ class DomainTestCase(ModoTestCase):
content = json.loads(response.content)
self.assertIn("test.com", content)
self.assertIn("test2.com", content)
def test_domain_detail_view(self):
"""Test Domain detail view."""
parameters.save_admin(
"ENABLE_DOMAIN_LIMITS", "no", app="limits")
domain = Domain.objects.get(name="test.com")
url = reverse("admin:domain_detail", args=[domain.pk])
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
self.assertIn("Information", response.content)
self.assertIn("Administrators", response.content)
self.assertNotIn("Resources usage", response.content)
parameters.save_admin(
"ENABLE_DOMAIN_LIMITS", "yes", app="limits")
response = self.client.get(url)
self.assertIn("Resources usage", response.content)
+2
View File
@@ -72,6 +72,8 @@ def create_domain_limits(sender, instance, **kwargs):
@receiver(admin_signals.extra_domain_dashboard_widgets)
def display_domain_limits(sender, user, domain, **kwargs):
"""Display resources usage for domain."""
if parameters.get_admin("ENABLE_DOMAIN_LIMITS") == "no":
return []
return [{
"column": "right",
"template": "limits/domain_resources_widget.html",