Skip to content

Commit f7d1d1c

Browse files
committed
Mock orchestrator
1 parent f1f74e4 commit f7d1d1c

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

tests/functional/test_telemetry.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
1313
import sqlite3
14-
from unittest.mock import MagicMock, patch
14+
from unittest.mock import MagicMock, PropertyMock, patch
1515

1616
import pytest
1717
from botocore.exceptions import MD5UnavailableError
@@ -313,12 +313,7 @@ def test_add_session_id_component_to_user_agent_extra():
313313

314314

315315
def test_entrypoint_catches_bare_exceptions():
316-
class FakeOrchestrator(CLISessionOrchestrator):
317-
def __init__(self):
318-
pass
319-
320-
def session_id(self):
321-
raise Exception()
322-
316+
mock_orchestrator = MagicMock(CLISessionOrchestrator)
317+
type(mock_orchestrator).session_id = PropertyMock(side_effect=Exception)
323318
session = MagicMock(Session)
324-
add_session_id_component_to_user_agent_extra(session, FakeOrchestrator())
319+
add_session_id_component_to_user_agent_extra(session, mock_orchestrator)

0 commit comments

Comments
 (0)