Skip to content

Commit

Permalink
test: updated tests to include the "subfolder"
Browse files Browse the repository at this point in the history
  • Loading branch information
TimPietrusky committed May 28, 2024
1 parent 37480c2 commit fa36d33
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Binary file added test_resources/images/test/ComfyUI_00001_.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions tests/test_rp_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def test_bucket_endpoint_not_configured(self, mock_upload_image, mock_exists):
mock_exists.return_value = True
mock_upload_image.return_value = "simulated_uploaded/image.png"

outputs = {"node_id": {"images": [{"filename": "ComfyUI_00001_.png"}]}}
outputs = {"node_id": {"images": [{"filename": "ComfyUI_00001_.png", "subfolder": ""}]}}
job_id = "123"

result = rp_handler.process_output_images(outputs, job_id)
Expand All @@ -155,7 +155,7 @@ def test_bucket_endpoint_configured(self, mock_upload_image, mock_exists):
mock_upload_image.return_value = "http://example.com/uploaded/image.png"

# Define the outputs and job_id for the test
outputs = {"node_id": {"images": [{"filename": "ComfyUI_00001_.png"}]}}
outputs = {"node_id": {"images": [{"filename": "ComfyUI_00001_.png", "subfolder": "test"}]}}
job_id = "123"

# Call the function under test
Expand All @@ -165,7 +165,7 @@ def test_bucket_endpoint_configured(self, mock_upload_image, mock_exists):
self.assertEqual(result["status"], "success")
self.assertEqual(result["message"], "http://example.com/uploaded/image.png")
mock_upload_image.assert_called_once_with(
job_id, "./test_resources/images/ComfyUI_00001_.png"
job_id, "./test_resources/images/test/ComfyUI_00001_.png"
)

@patch("rp_handler.os.path.exists")
Expand All @@ -188,7 +188,7 @@ def test_bucket_image_upload_fails_env_vars_wrong_or_missing(
# When AWS credentials are wrong or missing, upload_image should return 'simulated_uploaded/...'
mock_upload_image.return_value = "simulated_uploaded/image.png"

outputs = {"node_id": {"images": [{"filename": "ComfyUI_00001_.png"}]}}
outputs = {"node_id": {"images": [{"filename": "ComfyUI_00001_.png", "subfolder": "test"}]}}
job_id = "123"

result = rp_handler.process_output_images(outputs, job_id)
Expand Down

0 comments on commit fa36d33

Please sign in to comment.