mirror of https://github.com/dbcli/pgcli
change test to use a mock, update changelog & authors
This commit is contained in:
parent
e5bcd45de1
commit
f797b0bfdf
1
AUTHORS
1
AUTHORS
|
@ -133,6 +133,7 @@ Contributors:
|
|||
* Hollis Wu (holi0317)
|
||||
* Antonio Aguilar (crazybolillo)
|
||||
* Andrew M. MacFie (amacfie)
|
||||
* saucoide
|
||||
|
||||
Creator:
|
||||
--------
|
||||
|
|
|
@ -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:
|
||||
----------
|
||||
|
|
|
@ -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"
|
||||
]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue