diff options
| author | Igor Gumenyuk <me@exslim.net> | 2017-09-15 17:00:12 +0300 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-09-15 10:00:12 -0400 |
| commit | 86a18dc46aae3a4a6410e3f3d864fa0ec4e5b2cd (patch) | |
| tree | 5bd81988acb6723df14b0bd0ab1653721040e290 /tests | |
| parent | cb362a6750f421cc7ad7fabcd261da98de1cfcda (diff) | |
Fixed #28334 -- Added caching for hstore/citext OIDs.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/postgres_tests/test_signals.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_signals.py b/tests/postgres_tests/test_signals.py new file mode 100644 index 0000000000..a7112f014c --- /dev/null +++ b/tests/postgres_tests/test_signals.py @@ -0,0 +1,33 @@ +from django.db import connection + +from . import PostgreSQLTestCase + +try: + from django.contrib.postgres.signals import get_hstore_oids, get_citext_oids +except ImportError: + pass # pyscogp2 isn't installed. + + +class OIDTests(PostgreSQLTestCase): + + def assertOIDs(self, oids): + self.assertIsInstance(oids, tuple) + self.assertGreater(len(oids), 0) + self.assertTrue(all(isinstance(oid, int) for oid in oids)) + + def test_hstore_cache(self): + with self.assertNumQueries(0): + get_hstore_oids(connection.alias) + + def test_citext_cache(self): + with self.assertNumQueries(0): + get_citext_oids(connection.alias) + + def test_hstore_values(self): + oids, array_oids = get_hstore_oids(connection.alias) + self.assertOIDs(oids) + self.assertOIDs(array_oids) + + def test_citext_values(self): + oids = get_citext_oids(connection.alias) + self.assertOIDs(oids) |
