:param refresher: :return:
(refresher)
| 31 | |
| 32 | |
| 33 | def test_refresh_called_once(refresher): |
| 34 | """ |
| 35 | |
| 36 | :param refresher: |
| 37 | :return: |
| 38 | """ |
| 39 | callbacks = Mock() |
| 40 | pgexecute = Mock(**{"is_virtual_database.return_value": False}) |
| 41 | special = Mock() |
| 42 | |
| 43 | with patch.object(refresher, "_bg_refresh") as bg_refresh: |
| 44 | actual = refresher.refresh(pgexecute, special, callbacks) |
| 45 | time.sleep(1) # Wait for the thread to work. |
| 46 | assert len(actual) == 1 |
| 47 | assert len(actual[0]) == 4 |
| 48 | assert actual[0][3] == "Auto-completion refresh started in the background." |
| 49 | bg_refresh.assert_called_with(pgexecute, special, callbacks, None, None) |
| 50 | |
| 51 | |
| 52 | def test_refresh_called_twice(refresher): |