Skip to content

Commit 03ecb37

Browse files
committed
Add test_image_generation_unauthorized
1 parent 50d5153 commit 03ecb37

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/test_firefly_client.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,16 @@ def test_unexpected_response_format(client, mock_valid_ims_access_token_response
136136
)
137137
with pytest.raises(FireflyAPIError):
138138
client.generate_image(prompt="bad response")
139+
140+
141+
@responses.activate
142+
def test_image_generation_unauthorized(client, mock_valid_ims_access_token_response):
143+
# Mock image generation endpoint with 401 Unauthorized
144+
responses.add(
145+
responses.POST,
146+
IMAGE_URL,
147+
json={"error": "unauthorized"},
148+
status=401,
149+
)
150+
with pytest.raises(FireflyAuthError):
151+
client.generate_image(prompt="unauthorized access")

0 commit comments

Comments
 (0)