From f6f7941d7e9a263fd339a7e1a72dbcb7a2204f4c Mon Sep 17 00:00:00 2001 From: Joey Chatelain Date: Wed, 4 Dec 2024 15:00:39 -0800 Subject: [PATCH] add test for verbose name exception --- tom_common/tests.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tom_common/tests.py b/tom_common/tests.py index dae42f6c..7c85430b 100644 --- a/tom_common/tests.py +++ b/tom_common/tests.py @@ -9,6 +9,7 @@ from django_comments.models import Comment from tom_targets.tests.factories import SiderealTargetFactory +from tom_common.templatetags.tom_common_extras import * class TestCommonViews(TestCase): @@ -26,6 +27,17 @@ def test_index(self): self.assertEqual(response.status_code, 200) +class TestCommonExtras(TestCase): + def setUp(self): + pass + + def test_verbose_name(self): + # Check that the verbose name for a model field is returned correctly + self.assertEqual(verbose_name(User, 'email'), 'Email Address') + # Check that the verbose name for a non-existent field is returned correctly + self.assertEqual(verbose_name(User, 'definitely_not_a_field'), 'Definitely_Not_A_Field') + + class TestUserManagement(TestCase): def setUp(self): self.admin = User.objects.create_superuser(username='admin', password='admin', email='test@example.com')