Skip to content

Commit 4e4a90b

Browse files
Fix for failing Google Drive tests
1 parent 2ed94d4 commit 4e4a90b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Tests/ManagedCode.Storage.Tests/Storages/CloudDrive/GoogleDriveClientHttpTests.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,22 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
170170
if (path.StartsWith("/drive/v3/files/", StringComparison.OrdinalIgnoreCase))
171171
{
172172
var fileId = path["/drive/v3/files/".Length..];
173+
174+
// Handle PATCH for trash operation (soft delete)
175+
if (request.Method == HttpMethod.Patch)
176+
{
177+
if (!_entriesById.TryGetValue(fileId, out var entry))
178+
{
179+
return new HttpResponseMessage(HttpStatusCode.NotFound);
180+
}
181+
182+
// Remove the entry (simulates trashing)
183+
_entriesById.Remove(fileId);
184+
_idByParentAndName.Remove((entry.ParentId, entry.Name));
185+
186+
return JsonResponse(new { id = fileId, name = entry.Name, trashed = true });
187+
}
188+
173189
if (request.Method == HttpMethod.Delete)
174190
{
175191
if (!_entriesById.Remove(fileId))

0 commit comments

Comments
 (0)