Skip to content

Commit 5cfdb4f

Browse files
committed
Fixed unit test.
1 parent 355cde0 commit 5cfdb4f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/unitary/default_setup/model_deployment/test_model_deployment.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ class ModelDeploymentTestCase(unittest.TestCase):
2828
)
2929

3030
@patch("requests.post")
31-
def test_predict(self, mock_post):
31+
@patch("ads.model.deployment.model_deployment.ModelDeployment.sync")
32+
def test_predict(self, mock_sync, mock_post):
3233
"""Ensures predict model passes with valid input parameters."""
34+
mock_sync.return_value = Mock(lifecycle_state="ACTIVE")
3335
mock_post.return_value = Mock(
3436
status_code=200, json=lambda: {"result": "result"}
3537
)
@@ -50,8 +52,10 @@ def test_predict(self, mock_post):
5052
self.test_model_deployment.predict(data=np.array([1, 2, 3]))
5153

5254
@patch("requests.post")
53-
def test_predict_with_bytes(self, mock_post):
55+
@patch("ads.model.deployment.model_deployment.ModelDeployment.sync")
56+
def test_predict_with_bytes(self, mock_sync, mock_post):
5457
"""Ensures predict model passes with bytes input."""
58+
mock_sync.return_value = Mock(lifecycle_state="ACTIVE")
5559
byte_data = b"[[1,2,3,4]]"
5660
with patch.object(authutil, "default_signer") as mock_auth:
5761
auth = MagicMock()
@@ -66,8 +70,10 @@ def test_predict_with_bytes(self, mock_post):
6670
)
6771

6872
@patch("requests.post")
69-
def test_predict_with_auto_serialize_data(self, mock_post):
73+
@patch("ads.model.deployment.model_deployment.ModelDeployment.sync")
74+
def test_predict_with_auto_serialize_data(self, mock_sync, mock_post):
7075
"""Ensures predict model passes with valid input parameters."""
76+
mock_sync.return_value = Mock(lifecycle_state="ACTIVE")
7177
mock_post.return_value = Mock(
7278
status_code=200, json=lambda: {"result": "result"}
7379
)

0 commit comments

Comments
 (0)