Fixed a test isolation issue. Refs #17062.

This test could change settings.DATABASES['default']['TIME_ZONE'] and
didn't restore the previous value.
Fixed #21452 -- Non-autocommit connections to PostgreSQL.

When settings.DATABASES['default']['AUTOCOMMIT'] = False, the connection
wasn't in autocommit mode but Django pretended it was.

Thanks Anssi for analysing this issue.

Refs #17062.