From 10895e6156617fb711fe74341f6616e905606b57 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Wed, 11 Oct 2023 14:01:03 -0700 Subject: [PATCH] Mock function call in tests Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- test/deadline_submitter_for_maya/unit/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/deadline_submitter_for_maya/unit/__init__.py b/test/deadline_submitter_for_maya/unit/__init__.py index d02bc03..66b3052 100644 --- a/test/deadline_submitter_for_maya/unit/__init__.py +++ b/test/deadline_submitter_for_maya/unit/__init__.py @@ -1,7 +1,7 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. import sys -from unittest.mock import MagicMock +from unittest.mock import MagicMock, Mock # we must mock maya and UI code mock_modules = [ @@ -25,6 +25,13 @@ for module in mock_modules: sys.modules[module] = MagicMock() +# Mock the call to DeadlineCredentialsStatus.getInstance that happens at the module level +# in submit_job_to_deadline_dialog.py. That call is done at the module level to gather the +# status before the dialog is opened. +from deadline.client.ui.deadline_credentials_status import DeadlineCredentialsStatus + +DeadlineCredentialsStatus.getInstance = Mock(return_value=None) + def configure_mocks(): """Any extra mocking set up required"""