changeset 1235:05d618e3f353 modernize tip

Add unit test for max_users command.
author Brian Neal <bgneal@gmail.com>
date Fri, 06 Jun 2025 08:18:35 -0500
parents 26be530e8455
children
files core/tests/management/commands/test_max_users.py
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/tests/management/commands/test_max_users.py	Fri Jun 06 08:18:35 2025 -0500
@@ -0,0 +1,16 @@
+"""Test for the max_user management command."""
+from StringIO import StringIO
+import unittest
+
+from django.core.management import call_command
+from mock import patch
+
+
+class MaxUsersTestCase(unittest.TestCase):
+    @patch('core.management.commands.max_users.max_users')
+    def test_max_users(self, mock_max_users):
+        out = StringIO()
+        call_command('max_users', stdout=out)
+        self.assertEqual(out.getvalue(), '')
+        out.close()
+        mock_max_users.assert_called_once()