|
| 1 | +import time |
| 2 | +from concurrent.futures import ThreadPoolExecutor |
| 3 | + |
1 | 4 | import pytest
|
2 | 5 |
|
3 | 6 | from zulipterminal.config.keys import keys_for_command
|
@@ -86,6 +89,20 @@ def test__reset_footer_text(self, view, mocker, duration=46.2):
|
86 | 89 | mock_sleep.assert_called_once_with(duration)
|
87 | 90 | view.set_footer_text.assert_called_once_with()
|
88 | 91 |
|
| 92 | + def test__reset_footer_text_multiple_reset_attempts(self, view, |
| 93 | + mocker): |
| 94 | + time.sleep = mocker.Mock(side_effect=time.sleep) |
| 95 | + mocker.patch('zulipterminal.ui.View.set_footer_text') |
| 96 | + |
| 97 | + # Multiple simultaneous calls for resetting footer. |
| 98 | + with ThreadPoolExecutor(max_workers=3) as executor: |
| 99 | + executor.submit(view._reset_footer_text, duration=0.5) |
| 100 | + executor.submit(view._reset_footer_text, duration=0.5) |
| 101 | + executor.submit(view._reset_footer_text, duration=0.5) |
| 102 | + |
| 103 | + view.set_footer_text.assert_called_once_with() |
| 104 | + assert time.sleep.call_count == 3 |
| 105 | + |
89 | 106 | @pytest.mark.parametrize('suggestions, state, truncated, footer_text', [
|
90 | 107 | ([], None, False, [' [No matches found]']),
|
91 | 108 | (['some', 'text'], None, False, [[' '], ' some ', ' text ']),
|
|
0 commit comments