summaryrefslogtreecommitdiff
path: root/tests/aggregation
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2021-08-24 02:28:03 -0400
committerGitHub <noreply@github.com>2021-08-24 08:28:03 +0200
commit022d29c934107c515dd6d3181945146a2077bdf0 (patch)
treec6624a5b2d783f0a5380afc5a4c7fb065b6a7d67 /tests/aggregation
parented317e79e355bd3aacb1393b821df7b1a7267ebc (diff)
downloaddjango-022d29c934107c515dd6d3181945146a2077bdf0.tar.gz
Refs #10929 -- Allowed NowUTC SQL customization for third-party backends.
Diffstat (limited to 'tests/aggregation')
-rw-r--r--tests/aggregation/tests.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py
index 2de80f81db..c5fd590543 100644
--- a/tests/aggregation/tests.py
+++ b/tests/aggregation/tests.py
@@ -26,14 +26,10 @@ class NowUTC(Now):
template = 'CURRENT_TIMESTAMP'
output_field = DateTimeField()
- def as_mysql(self, compiler, connection, **extra_context):
- return self.as_sql(compiler, connection, template='UTC_TIMESTAMP', **extra_context)
-
- def as_oracle(self, compiler, connection, **extra_context):
- return self.as_sql(compiler, connection, template="CURRENT_TIMESTAMP AT TIME ZONE 'UTC'", **extra_context)
-
- def as_postgresql(self, compiler, connection, **extra_context):
- return self.as_sql(compiler, connection, template="STATEMENT_TIMESTAMP() AT TIME ZONE 'UTC'", **extra_context)
+ def as_sql(self, compiler, connection, **extra_context):
+ if connection.features.test_now_utc_template:
+ extra_context['template'] = connection.features.test_now_utc_template
+ return super().as_sql(compiler, connection, **extra_context)
class AggregateTestCase(TestCase):