summaryrefslogtreecommitdiff
path: root/tests/fixtures/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/fixtures/tests.py')
-rw-r--r--tests/fixtures/tests.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/tests/fixtures/tests.py b/tests/fixtures/tests.py
index 9eb2740c90..deac1c2d77 100644
--- a/tests/fixtures/tests.py
+++ b/tests/fixtures/tests.py
@@ -916,15 +916,11 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
with self.assertRaisesMessage(IntegrityError, msg):
management.call_command("loaddata", "invalid.json", verbosity=0)
- @unittest.skipUnless(
- connection.vendor == "postgresql", "psycopg2 prohibits null characters in data."
- )
+ @skipUnlessDBFeature("prohibits_null_characters_in_text_exception")
def test_loaddata_null_characters_on_postgresql(self):
- msg = (
- "Could not load fixtures.Article(pk=2): "
- "A string literal cannot contain NUL (0x00) characters."
- )
- with self.assertRaisesMessage(ValueError, msg):
+ error, msg = connection.features.prohibits_null_characters_in_text_exception
+ msg = f"Could not load fixtures.Article(pk=2): {msg}"
+ with self.assertRaisesMessage(error, msg):
management.call_command("loaddata", "null_character_in_field_value.json")
def test_loaddata_app_option(self):