summaryrefslogtreecommitdiff
path: root/tests/dbshell
diff options
context:
space:
mode:
authorHasan Ramezani <hasan.r67@gmail.com>2021-02-24 17:16:45 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-03-01 09:33:49 +0100
commit8380fe08a025bd41b242c545f7c1b4f333274cbc (patch)
tree8ee70bbde10fffce3ab8bc39b94d3cfbd33d064b /tests/dbshell
parent9f125fce7971714333d23c7f554411342466721c (diff)
downloaddjango-8380fe08a025bd41b242c545f7c1b4f333274cbc.tar.gz
Fixed #32456 -- Added dbshell support for specifying a password file on PostgreSQL.
Diffstat (limited to 'tests/dbshell')
-rw-r--r--tests/dbshell/test_postgresql.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/dbshell/test_postgresql.py b/tests/dbshell/test_postgresql.py
index 3345035a24..a96acac6f1 100644
--- a/tests/dbshell/test_postgresql.py
+++ b/tests/dbshell/test_postgresql.py
@@ -73,6 +73,34 @@ class PostgreSqlDbshellCommandTestCase(SimpleTestCase):
(['psql'], {'PGSERVICE': 'django_test'}),
)
+ def test_passfile(self):
+ self.assertEqual(
+ self.settings_to_cmd_args_env({
+ 'NAME': 'dbname',
+ 'USER': 'someuser',
+ 'HOST': 'somehost',
+ 'PORT': '444',
+ 'OPTIONS': {
+ 'passfile': '~/.custompgpass',
+ },
+ }),
+ (
+ ['psql', '-U', 'someuser', '-h', 'somehost', '-p', '444', 'dbname'],
+ {'PGPASSFILE': '~/.custompgpass'},
+ ),
+ )
+ self.assertEqual(
+ self.settings_to_cmd_args_env({
+ 'OPTIONS': {
+ 'service': 'django_test',
+ 'passfile': '~/.custompgpass',
+ },
+ }),
+ (
+ ['psql'], {'PGSERVICE': 'django_test', 'PGPASSFILE': '~/.custompgpass'},
+ ),
+ )
+
def test_column(self):
self.assertEqual(
self.settings_to_cmd_args_env({