Skip to content

Commit 59108c1

Browse files
authored
FIX remove obsolete assertions from image target integration tests (microsoft#1294)
1 parent b62672f commit 59108c1

1 file changed

Lines changed: 5 additions & 21 deletions

File tree

tests/integration/targets/test_targets_and_secrets.py

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -280,19 +280,14 @@ async def test_connect_openai_completion(sqlite_instance):
280280

281281
@pytest.mark.asyncio
282282
@pytest.mark.parametrize(
283-
("endpoint", "api_key", "model_name", "is_dalle_model"),
283+
("endpoint", "api_key", "model_name"),
284284
[
285-
("OPENAI_IMAGE_ENDPOINT1", "OPENAI_IMAGE_API_KEY1", "OPENAI_IMAGE_MODEL1", True), # DALL-E-3
286-
("OPENAI_IMAGE_ENDPOINT2", "OPENAI_IMAGE_API_KEY2", "OPENAI_IMAGE_MODEL2", False), # gpt-image-1
287-
(
288-
"PLATFORM_OPENAI_IMAGE_ENDPOINT",
289-
"PLATFORM_OPENAI_IMAGE_KEY",
290-
"PLATFORM_OPENAI_IMAGE_MODEL",
291-
True,
292-
), # DALL-E-3
285+
("OPENAI_IMAGE_ENDPOINT1", "OPENAI_IMAGE_API_KEY1", "OPENAI_IMAGE_MODEL1"), # DALL-E-3
286+
("OPENAI_IMAGE_ENDPOINT2", "OPENAI_IMAGE_API_KEY2", "OPENAI_IMAGE_MODEL2"), # gpt-image-1
287+
("PLATFORM_OPENAI_IMAGE_ENDPOINT", "PLATFORM_OPENAI_IMAGE_KEY", "PLATFORM_OPENAI_IMAGE_MODEL"), # DALL-E-3
293288
],
294289
)
295-
async def test_connect_image(sqlite_instance, endpoint, api_key, model_name, is_dalle_model):
290+
async def test_connect_image(sqlite_instance, endpoint, api_key, model_name):
296291
endpoint_value = _get_required_env_var(endpoint)
297292
api_key_value = _get_required_env_var(api_key)
298293
model_name_value = os.getenv(model_name) if model_name else ""
@@ -303,9 +298,6 @@ async def test_connect_image(sqlite_instance, endpoint, api_key, model_name, is_
303298
model_name=model_name_value,
304299
)
305300

306-
# Verify the flag starts as False
307-
assert target._requires_response_format is False
308-
309301
image_prompt = "A simple test image of a raccoon"
310302
attack = PromptSendingAttack(objective_target=target)
311303
result = await attack.execute_async(objective=image_prompt)
@@ -322,14 +314,6 @@ async def test_connect_image(sqlite_instance, endpoint, api_key, model_name, is_
322314
assert image_path.exists(), f"Image file not found at path: {image_path}"
323315
assert image_path.is_file(), f"Path exists but is not a file: {image_path}"
324316

325-
# Verify the adaptive response_format flag behavior
326-
# DALL-E models return URLs by default, so flag should be set to True after first call
327-
# gpt-image-1 always returns base64, so flag should remain False
328-
if is_dalle_model:
329-
assert target._requires_response_format is True, "DALL-E model should set response_format flag to True"
330-
else:
331-
assert target._requires_response_format is False, "gpt-image-1 should keep response_format flag as False"
332-
333317

334318
@pytest.mark.asyncio
335319
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)