mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #32687 -- Restored passing process’ environment to underlying tool in dbshell on PostgreSQL.
Regression in bbe6fbb876.
This commit is contained in:
committed by
Mariusz Felisiak
parent
1871182031
commit
6e742dabc9
@@ -1,3 +1,5 @@
|
||||
from unittest import mock
|
||||
|
||||
from django.db import connection
|
||||
from django.db.backends.base.client import BaseDatabaseClient
|
||||
from django.test import SimpleTestCase
|
||||
@@ -14,3 +16,15 @@ class SimpleDatabaseClientTests(SimpleTestCase):
|
||||
)
|
||||
with self.assertRaisesMessage(NotImplementedError, msg):
|
||||
self.client.settings_to_cmd_args_env(None, None)
|
||||
|
||||
def test_runshell_use_environ(self):
|
||||
for env in [None, {}]:
|
||||
with self.subTest(env=env):
|
||||
with mock.patch('subprocess.run') as run:
|
||||
with mock.patch.object(
|
||||
BaseDatabaseClient,
|
||||
'settings_to_cmd_args_env',
|
||||
return_value=([], env),
|
||||
):
|
||||
self.client.runshell(None)
|
||||
run.assert_called_once_with([], env=None, check=True)
|
||||
|
||||
Reference in New Issue
Block a user