diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-09-06 04:17:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-09-06 04:17:09 +0000 |
commit | 76d27bc43d56d7ef3ca0090fb199777888adf7c3 (patch) | |
tree | b6d3d562a0be03d404426bb43aff62174be3dc5e /tests/test_completion_refresher.py | |
parent | Adding upstream version 3.1.0. (diff) | |
download | pgcli-76d27bc43d56d7ef3ca0090fb199777888adf7c3.tar.xz pgcli-76d27bc43d56d7ef3ca0090fb199777888adf7c3.zip |
Adding upstream version 3.2.0.upstream/3.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_completion_refresher.py')
-rw-r--r-- | tests/test_completion_refresher.py | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/tests/test_completion_refresher.py b/tests/test_completion_refresher.py index 6a916a8..a5529d6 100644 --- a/tests/test_completion_refresher.py +++ b/tests/test_completion_refresher.py @@ -1,6 +1,6 @@ import time import pytest -from mock import Mock, patch +from unittest.mock import Mock, patch @pytest.fixture @@ -37,7 +37,7 @@ def test_refresh_called_once(refresher): :return: """ callbacks = Mock() - pgexecute = Mock() + pgexecute = Mock(**{"is_virtual_database.return_value": False}) special = Mock() with patch.object(refresher, "_bg_refresh") as bg_refresh: @@ -57,7 +57,7 @@ def test_refresh_called_twice(refresher): """ callbacks = Mock() - pgexecute = Mock() + pgexecute = Mock(**{"is_virtual_database.return_value": False}) special = Mock() def dummy_bg_refresh(*args): @@ -84,14 +84,12 @@ def test_refresh_with_callbacks(refresher): :param refresher: """ callbacks = [Mock()] - pgexecute_class = Mock() - pgexecute = Mock() + pgexecute = Mock(**{"is_virtual_database.return_value": False}) pgexecute.extra_args = {} special = Mock() - with patch("pgcli.completion_refresher.PGExecute", pgexecute_class): - # Set refreshers to 0: we're not testing refresh logic here - refresher.refreshers = {} - refresher.refresh(pgexecute, special, callbacks) - time.sleep(1) # Wait for the thread to work. - assert callbacks[0].call_count == 1 + # Set refreshers to 0: we're not testing refresh logic here + refresher.refreshers = {} + refresher.refresh(pgexecute, special, callbacks) + time.sleep(1) # Wait for the thread to work. + assert callbacks[0].call_count == 1 |