Skip to content

Commit

Permalink
fix djmain changes the error message text
Browse files Browse the repository at this point in the history
  • Loading branch information
n2ygk committed Sep 6, 2024
1 parent 5ce5e7f commit 17b1ba9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ def test_validation_failed_message(self):
stdout=output,
)

self.assertIn("user", output.getvalue())
self.assertIn("783", output.getvalue())
self.assertIn("does not exist", output.getvalue())
output_str = output.getvalue()
self.assertIn("user", output_str)
self.assertIn("783", output_str)
# newer Django (>5.1) changes the error message from "does not exist" to "is not a valid choice"
self.assertTrue(
any(substring in output_str for substring in ["does not exist", "is not a valid choice"]),
f"Output did not contain 'does not exist' or 'is not a valid choice'. Actual output: {output_str}",
)

0 comments on commit 17b1ba9

Please sign in to comment.