diff --git a/tests/integration/test_aws_cli_commands.py b/tests/integration/test_aws_cli_commands.py index ab8aeff..ea5010e 100644 --- a/tests/integration/test_aws_cli_commands.py +++ b/tests/integration/test_aws_cli_commands.py @@ -138,7 +138,9 @@ class TestSyncCommand: return PutSummary( operation="create_reference", bucket="test-bucket", - key=f"{delta_space.prefix}/{local_path.name}.delta" if delta_space.prefix else f"{local_path.name}.delta", + key=f"{delta_space.prefix}/{local_path.name}.delta" + if delta_space.prefix + else f"{local_path.name}.delta", original_name=local_path.name, file_size=local_path.stat().st_size, file_sha256="ghi789", @@ -146,6 +148,7 @@ class TestSyncCommand: delta_ratio=None, ref_key=None, ) + mock_service.put.side_effect = mock_put with patch("deltaglider.app.cli.main.create_service", return_value=mock_service): diff --git a/tests/integration/test_bucket_management.py b/tests/integration/test_bucket_management.py index df547c8..ede66c8 100644 --- a/tests/integration/test_bucket_management.py +++ b/tests/integration/test_bucket_management.py @@ -255,7 +255,9 @@ class TestBucketManagement: call_count = {"value": 0} - def fake_get_bucket_stats(_: Any, bucket: str, mode: str, use_cache: bool = True, refresh_cache: bool = False) -> BucketStats: + def fake_get_bucket_stats( + _: Any, bucket: str, mode: str, use_cache: bool = True, refresh_cache: bool = False + ) -> BucketStats: call_count["value"] += 1 assert bucket == "bucket1" if mode == "detailed": diff --git a/tests/integration/test_client.py b/tests/integration/test_client.py index 9286f81..1ffa590 100644 --- a/tests/integration/test_client.py +++ b/tests/integration/test_client.py @@ -43,7 +43,15 @@ class MockStorage: if obj_head is not None: yield obj_head - def list_objects(self, bucket, prefix="", delimiter="", max_keys=1000, start_after=None, continuation_token=None): + def list_objects( + self, + bucket, + prefix="", + delimiter="", + max_keys=1000, + start_after=None, + continuation_token=None, + ): """Mock list_objects operation for S3 features.""" objects = [] common_prefixes = set() diff --git a/tests/integration/test_stats_command.py b/tests/integration/test_stats_command.py index 8d5341d..5c21ef2 100644 --- a/tests/integration/test_stats_command.py +++ b/tests/integration/test_stats_command.py @@ -49,7 +49,9 @@ class TestStatsCommand: assert output["direct_objects"] == 3 # Verify client was called correctly - mock_client.get_bucket_stats.assert_called_once_with("test-bucket", mode="quick", use_cache=True, refresh_cache=False) + mock_client.get_bucket_stats.assert_called_once_with( + "test-bucket", mode="quick", use_cache=True, refresh_cache=False + ) def test_stats_json_output_detailed(self): """Test stats command with detailed JSON output.""" @@ -77,7 +79,9 @@ class TestStatsCommand: assert output["average_compression_ratio"] == 0.95 # Verify detailed flag was passed - mock_client.get_bucket_stats.assert_called_once_with("test-bucket", mode="detailed", use_cache=True, refresh_cache=False) + mock_client.get_bucket_stats.assert_called_once_with( + "test-bucket", mode="detailed", use_cache=True, refresh_cache=False + ) def test_stats_json_output_sampled(self): """Test stats command with sampled JSON output.""" @@ -101,7 +105,9 @@ class TestStatsCommand: result = runner.invoke(cli, ["stats", "test-bucket", "--sampled", "--json"]) assert result.exit_code == 0 - mock_client.get_bucket_stats.assert_called_once_with("test-bucket", mode="sampled", use_cache=True, refresh_cache=False) + mock_client.get_bucket_stats.assert_called_once_with( + "test-bucket", mode="sampled", use_cache=True, refresh_cache=False + ) def test_stats_sampled_and_detailed_conflict(self): """--sampled and --detailed flags must be mutually exclusive.""" @@ -190,7 +196,9 @@ class TestStatsCommand: assert result.exit_code == 0 # Verify bucket name was parsed correctly from S3 URL - mock_client.get_bucket_stats.assert_called_once_with("test-bucket", mode="quick", use_cache=True, refresh_cache=False) + mock_client.get_bucket_stats.assert_called_once_with( + "test-bucket", mode="quick", use_cache=True, refresh_cache=False + ) def test_stats_with_s3_url_trailing_slash(self): """Test stats command with s3:// URL format with trailing slash.""" @@ -215,7 +223,9 @@ class TestStatsCommand: assert result.exit_code == 0 # Verify bucket name was parsed correctly from S3 URL with trailing slash - mock_client.get_bucket_stats.assert_called_once_with("test-bucket", mode="quick", use_cache=True, refresh_cache=False) + mock_client.get_bucket_stats.assert_called_once_with( + "test-bucket", mode="quick", use_cache=True, refresh_cache=False + ) def test_stats_with_s3_url_with_prefix(self): """Test stats command with s3:// URL format with prefix (should ignore prefix).""" @@ -240,4 +250,6 @@ class TestStatsCommand: assert result.exit_code == 0 # Verify only bucket name was extracted, prefix ignored - mock_client.get_bucket_stats.assert_called_once_with("test-bucket", mode="quick", use_cache=True, refresh_cache=False) + mock_client.get_bucket_stats.assert_called_once_with( + "test-bucket", mode="quick", use_cache=True, refresh_cache=False + )