Skip to content

Commit

Permalink
Additional test to fix coverage of error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
rtuck99 committed Feb 4, 2025
1 parent 58e08ba commit f7e9978
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from unittest.mock import ANY, patch

import pytest
from requests import JSONDecodeError

from mx_bluesky.common.external_interaction.ispyb.exp_eye_store import (
BearerAuth,
Expand Down Expand Up @@ -47,6 +48,16 @@ def test_when_start_called_then_returns_id(mock_post):
assert robot_id == 190


@patch("mx_bluesky.common.external_interaction.ispyb.exp_eye_store.post")
def test_when_bad_response_no_json_handled_correctly(mock_post):
mock_post.return_value.ok = False
mock_post.return_value.json.side_effect = JSONDecodeError("Unable to decode", "", 0)

expeye_interactor = ExpeyeInteraction()
with pytest.raises(ISPyBDepositionNotMade):
expeye_interactor.start_load("test", 3, 700, 10, 5)


@patch("mx_bluesky.common.external_interaction.ispyb.exp_eye_store.post")
def test_when_start_load_called_then_use_correct_token(
mock_post,
Expand Down

0 comments on commit f7e9978

Please sign in to comment.