mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #35569 -- Improved wording of invalid ForeignKey error message.
This commit is contained in:
@@ -523,7 +523,7 @@ class CreatesuperuserManagementCommandTestCase(TestCase):
|
||||
self.assertEqual(u.group, group)
|
||||
|
||||
non_existent_email = "mymail2@gmail.com"
|
||||
msg = "email instance with email %r does not exist." % non_existent_email
|
||||
msg = "email instance with email %r is not a valid choice." % non_existent_email
|
||||
with self.assertRaisesMessage(CommandError, msg):
|
||||
call_command(
|
||||
"createsuperuser",
|
||||
@@ -594,7 +594,7 @@ class CreatesuperuserManagementCommandTestCase(TestCase):
|
||||
email = Email.objects.create(email="mymail@gmail.com")
|
||||
Group.objects.all().delete()
|
||||
nonexistent_group_id = 1
|
||||
msg = f"group instance with id {nonexistent_group_id} does not exist."
|
||||
msg = f"group instance with id {nonexistent_group_id} is not a valid choice."
|
||||
|
||||
with self.assertRaisesMessage(CommandError, msg):
|
||||
call_command(
|
||||
@@ -611,7 +611,7 @@ class CreatesuperuserManagementCommandTestCase(TestCase):
|
||||
email = Email.objects.create(email="mymail@gmail.com")
|
||||
Group.objects.all().delete()
|
||||
nonexistent_group_id = 1
|
||||
msg = f"group instance with id {nonexistent_group_id} does not exist."
|
||||
msg = f"group instance with id {nonexistent_group_id} is not a valid choice."
|
||||
|
||||
with mock.patch.dict(
|
||||
os.environ,
|
||||
@@ -631,7 +631,7 @@ class CreatesuperuserManagementCommandTestCase(TestCase):
|
||||
email = Email.objects.create(email="mymail@gmail.com")
|
||||
Group.objects.all().delete()
|
||||
nonexistent_group_id = 1
|
||||
msg = f"group instance with id {nonexistent_group_id} does not exist."
|
||||
msg = f"group instance with id {nonexistent_group_id} is not a valid choice."
|
||||
|
||||
@mock_inputs(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user