1
0
Fork 0

change test to use a mock, update changelog & authors

This commit is contained in:
saucoide 2024-04-28 23:17:58 +02:00
parent e5bcd45de1
commit f797b0bfdf
3 changed files with 8 additions and 3 deletions

View File

@ -133,6 +133,7 @@ Contributors:
* Hollis Wu (holi0317)
* Antonio Aguilar (crazybolillo)
* Andrew M. MacFie (amacfie)
* saucoide
Creator:
--------

View File

@ -8,6 +8,8 @@ Features:
displaying of all Postgres error fields received.
* Show Postgres notifications.
* Support sqlparse 0.5.x
* Add `--log-file [filename]` cli argument and `\log-file [filename]` special commands to
log to an external file in addition to the normal output
Bug fixes:
----------

View File

@ -352,10 +352,12 @@ def test_logfile_works(executor):
@dbtest
def test_logfile_unwriteable_file(executor):
cli = PGCli(pgexecute=executor)
statement = r"\log-file /etc/forbidden.log"
result = run(executor, statement, pgspecial=cli.pgspecial)
statement = r"\log-file forbidden.log"
with mock.patch("builtins.open") as mock_open:
mock_open.side_effect = PermissionError("[Errno 13] Permission denied: 'forbidden.log'")
result = run(executor, statement, pgspecial=cli.pgspecial)
assert result == [
"[Errno 13] Permission denied: '/etc/forbidden.log'\nLogfile capture disabled"
"[Errno 13] Permission denied: 'forbidden.log'\nLogfile capture disabled"
]