first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,266 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
describe('Google Drive V2', () => {
|
||||
const credentials = {
|
||||
googleDriveOAuth2Api: {
|
||||
scope: 'https://www.googleapis.com/auth/drive',
|
||||
oauthTokenData: {
|
||||
access_token: 'test-access-token',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
describe('Folder Create Operation', () => {
|
||||
beforeAll(() => {
|
||||
const mock = nock('https://www.googleapis.com');
|
||||
|
||||
// Mock folder creation
|
||||
mock
|
||||
.post('/drive/v3/files')
|
||||
.query(true)
|
||||
.reply(200, {
|
||||
id: '1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms',
|
||||
name: 'Test Folder',
|
||||
mimeType: 'application/vnd.google-apps.folder',
|
||||
createdTime: '2024-01-01T00:00:00.000Z',
|
||||
modifiedTime: '2024-01-01T00:00:00.000Z',
|
||||
webViewLink:
|
||||
'https://drive.google.com/drive/folders/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms',
|
||||
})
|
||||
.persist();
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['folder-create-basic.workflow.json'],
|
||||
});
|
||||
});
|
||||
|
||||
// Note: File Upload operations are skipped from workflow tests due to binary data complexity
|
||||
// The upload functionality is thoroughly tested in the dedicated unit tests
|
||||
|
||||
describe('File Operations', () => {
|
||||
beforeAll(() => {
|
||||
const mock = nock('https://www.googleapis.com');
|
||||
|
||||
// Mock file copy - correct endpoint
|
||||
mock
|
||||
.post('/drive/v3/files/123/copy')
|
||||
.query(true)
|
||||
.reply(200, {
|
||||
id: 'copy123',
|
||||
name: 'Copy of Test File',
|
||||
mimeType: 'text/plain',
|
||||
})
|
||||
.persist();
|
||||
|
||||
// Mock file createFromText - multipart upload
|
||||
mock
|
||||
.post('/upload/drive/v3/files')
|
||||
.query({ uploadType: 'multipart', supportsAllDrives: true })
|
||||
.reply(200, {
|
||||
id: '1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms',
|
||||
name: 'Test Text File',
|
||||
mimeType: 'text/plain',
|
||||
})
|
||||
.persist();
|
||||
|
||||
// Mock metadata update after createFromText
|
||||
mock
|
||||
.patch('/drive/v3/files/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms')
|
||||
.query(true)
|
||||
.reply(200, {
|
||||
id: '1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms',
|
||||
name: 'Test Text File',
|
||||
mimeType: 'text/plain',
|
||||
size: '48',
|
||||
createdTime: '2024-01-01T00:00:00.000Z',
|
||||
modifiedTime: '2024-01-01T00:00:00.000Z',
|
||||
})
|
||||
.persist();
|
||||
|
||||
// Mock file download - metadata fetch first
|
||||
mock
|
||||
.get('/drive/v3/files/123')
|
||||
.query({ fields: 'mimeType,name', supportsTeamDrives: true, supportsAllDrives: true })
|
||||
.reply(200, {
|
||||
id: '123',
|
||||
name: 'Test File',
|
||||
mimeType: 'text/plain',
|
||||
})
|
||||
.persist();
|
||||
|
||||
// Mock file download - content download
|
||||
mock
|
||||
.get('/drive/v3/files/123')
|
||||
.query({ alt: 'media', supportsAllDrives: true })
|
||||
.reply(200, 'Hello World', {
|
||||
'Content-Type': 'text/plain',
|
||||
})
|
||||
.persist();
|
||||
|
||||
mock.delete('/drive/v3/files/123').query(true).reply(200).persist();
|
||||
|
||||
mock
|
||||
.get('/drive/v3/files/123')
|
||||
.query(true)
|
||||
.reply(200, {
|
||||
id: '123',
|
||||
name: 'Test File',
|
||||
mimeType: 'text/plain',
|
||||
size: '1024',
|
||||
})
|
||||
.persist();
|
||||
|
||||
mock
|
||||
.patch('/drive/v3/files/123')
|
||||
.query(true)
|
||||
.reply(200, {
|
||||
id: '123',
|
||||
name: 'Updated Test File',
|
||||
mimeType: 'text/plain',
|
||||
})
|
||||
.persist();
|
||||
|
||||
mock
|
||||
.post('/drive/v3/files/123/permissions')
|
||||
.query(true)
|
||||
.reply(200, {
|
||||
id: 'permission123',
|
||||
role: 'reader',
|
||||
type: 'user',
|
||||
})
|
||||
.persist();
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: [
|
||||
'file-copy.workflow.json',
|
||||
'file-createFromText.workflow.json',
|
||||
'file-delete.workflow.json',
|
||||
'file-download.workflow.json',
|
||||
'file-move.workflow.json',
|
||||
'file-share.workflow.json',
|
||||
'file-update.workflow.json',
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
describe('Folder Operations', () => {
|
||||
beforeAll(() => {
|
||||
const mock = nock('https://www.googleapis.com');
|
||||
|
||||
// Mock folder delete
|
||||
mock.delete('/drive/v3/files/folder123').query(true).reply(200).persist();
|
||||
|
||||
// Mock folder share
|
||||
mock
|
||||
.post('/drive/v3/files/folder123/permissions')
|
||||
.query(true)
|
||||
.reply(200, {
|
||||
id: 'permission123',
|
||||
role: 'reader',
|
||||
type: 'user',
|
||||
})
|
||||
.persist();
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['folder-delete.workflow.json', 'folder-share.workflow.json'],
|
||||
});
|
||||
});
|
||||
|
||||
describe('File/Folder Search Operations', () => {
|
||||
beforeAll(() => {
|
||||
const mock = nock('https://www.googleapis.com');
|
||||
|
||||
// Mock search
|
||||
mock
|
||||
.get('/drive/v3/files')
|
||||
.query(true)
|
||||
.reply(200, {
|
||||
files: [
|
||||
{
|
||||
id: '123',
|
||||
name: 'Test File',
|
||||
mimeType: 'text/plain',
|
||||
},
|
||||
{
|
||||
id: 'folder123',
|
||||
name: 'Test Folder',
|
||||
mimeType: 'application/vnd.google-apps.folder',
|
||||
},
|
||||
],
|
||||
})
|
||||
.persist();
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['filefolder-search.workflow.json'],
|
||||
});
|
||||
});
|
||||
|
||||
describe('Shared Drive Operations', () => {
|
||||
beforeAll(() => {
|
||||
const mock = nock('https://www.googleapis.com');
|
||||
|
||||
// Mock drive operations
|
||||
mock
|
||||
.post('/drive/v3/drives')
|
||||
.query(true)
|
||||
.reply(200, {
|
||||
id: 'drive123',
|
||||
name: 'Test Drive',
|
||||
})
|
||||
.persist();
|
||||
|
||||
mock.delete('/drive/v3/drives/drive123').query(true).reply(200).persist();
|
||||
|
||||
mock
|
||||
.get('/drive/v3/drives/drive123')
|
||||
.query(true)
|
||||
.reply(200, {
|
||||
id: 'drive123',
|
||||
name: 'Test Drive',
|
||||
})
|
||||
.persist();
|
||||
|
||||
mock
|
||||
.get('/drive/v3/drives')
|
||||
.query(true)
|
||||
.reply(200, {
|
||||
drives: [
|
||||
{
|
||||
id: 'drive123',
|
||||
name: 'Test Drive',
|
||||
},
|
||||
],
|
||||
})
|
||||
.persist();
|
||||
|
||||
mock
|
||||
.patch('/drive/v3/drives/drive123')
|
||||
.query(true)
|
||||
.reply(200, {
|
||||
id: 'drive123',
|
||||
name: 'Updated Test Drive',
|
||||
})
|
||||
.persist();
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: [
|
||||
'drive-create.workflow.json',
|
||||
'drive-delete.workflow.json',
|
||||
'drive-get.workflow.json',
|
||||
'drive-list.workflow.json',
|
||||
'drive-update.workflow.json',
|
||||
],
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"name": "Google Drive V2 Drive Create Test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "trigger-id",
|
||||
"name": "When clicking 'Execute Workflow'"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "drive",
|
||||
"operation": "create",
|
||||
"name": "Test Drive"
|
||||
},
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"typeVersion": 3,
|
||||
"position": [200, 0],
|
||||
"id": "drive-create",
|
||||
"name": "Create Drive",
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "test-credential-id",
|
||||
"name": "Test Google Drive OAuth2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Create Drive": [
|
||||
{
|
||||
"json": {
|
||||
"id": "drive123",
|
||||
"name": "Test Drive"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking 'Execute Workflow'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create Drive",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"name": "Google Drive V2 Drive Delete Test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "trigger-id",
|
||||
"name": "When clicking 'Execute Workflow'"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "drive",
|
||||
"operation": "deleteDrive",
|
||||
"driveId": {
|
||||
"__rl": true,
|
||||
"value": "drive123",
|
||||
"mode": "id"
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"typeVersion": 3,
|
||||
"position": [200, 0],
|
||||
"id": "drive-delete",
|
||||
"name": "Delete Drive",
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "test-credential-id",
|
||||
"name": "Test Google Drive OAuth2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Delete Drive": [
|
||||
{
|
||||
"json": {
|
||||
"success": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking 'Execute Workflow'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Delete Drive",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"name": "Google Drive V2 Drive Get Test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "trigger-id",
|
||||
"name": "When clicking 'Execute Workflow'"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "drive",
|
||||
"operation": "get",
|
||||
"driveId": {
|
||||
"__rl": true,
|
||||
"value": "drive123",
|
||||
"mode": "id"
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"typeVersion": 3,
|
||||
"position": [200, 0],
|
||||
"id": "drive-get",
|
||||
"name": "Get Drive",
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "test-credential-id",
|
||||
"name": "Test Google Drive OAuth2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Get Drive": [
|
||||
{
|
||||
"json": {
|
||||
"id": "drive123",
|
||||
"name": "Test Drive"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking 'Execute Workflow'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get Drive",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"name": "Google Drive V2 Drive List Test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "trigger-id",
|
||||
"name": "When clicking 'Execute Workflow'"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "drive",
|
||||
"operation": "list"
|
||||
},
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"typeVersion": 3,
|
||||
"position": [200, 0],
|
||||
"id": "drive-list",
|
||||
"name": "List Drives",
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "test-credential-id",
|
||||
"name": "Test Google Drive OAuth2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"List Drives": [
|
||||
{
|
||||
"json": {
|
||||
"id": "drive123",
|
||||
"name": "Test Drive"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking 'Execute Workflow'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "List Drives",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"name": "Google Drive V2 Drive Update Test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "trigger-id",
|
||||
"name": "When clicking 'Execute Workflow'"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "drive",
|
||||
"operation": "update",
|
||||
"driveId": {
|
||||
"__rl": true,
|
||||
"value": "drive123",
|
||||
"mode": "id"
|
||||
},
|
||||
"options": {
|
||||
"name": "Updated Test Drive"
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"typeVersion": 3,
|
||||
"position": [200, 0],
|
||||
"id": "drive-update",
|
||||
"name": "Update Drive",
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "test-credential-id",
|
||||
"name": "Test Google Drive OAuth2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Update Drive": [
|
||||
{
|
||||
"json": {
|
||||
"id": "drive123",
|
||||
"name": "Updated Test Drive"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking 'Execute Workflow'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Update Drive",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"name": "Google Drive V2 File Copy Test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "trigger-id",
|
||||
"name": "When clicking 'Execute Workflow'"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "file",
|
||||
"operation": "copy",
|
||||
"fileId": {
|
||||
"__rl": true,
|
||||
"value": "123",
|
||||
"mode": "id"
|
||||
},
|
||||
"name": "Copy of Test File"
|
||||
},
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"typeVersion": 3,
|
||||
"position": [200, 0],
|
||||
"id": "file-copy",
|
||||
"name": "Copy File",
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "test-credential-id",
|
||||
"name": "Test Google Drive OAuth2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Copy File": [
|
||||
{
|
||||
"json": {
|
||||
"id": "copy123",
|
||||
"name": "Copy of Test File",
|
||||
"mimeType": "text/plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking 'Execute Workflow'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Copy File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"name": "Google Drive V2 File Create From Text Test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "trigger-id",
|
||||
"name": "When clicking 'Execute Workflow'"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "file",
|
||||
"operation": "createFromText",
|
||||
"name": "Test Text File",
|
||||
"content": "Hello World! This is a test file created from text."
|
||||
},
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"typeVersion": 3,
|
||||
"position": [200, 0],
|
||||
"id": "file-createFromText",
|
||||
"name": "Create File From Text",
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "test-credential-id",
|
||||
"name": "Test Google Drive OAuth2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Create File From Text": [
|
||||
{
|
||||
"json": {
|
||||
"id": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking 'Execute Workflow'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create File From Text",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"name": "Google Drive V2 File Delete Test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "trigger-id",
|
||||
"name": "When clicking 'Execute Workflow'"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "file",
|
||||
"operation": "deleteFile",
|
||||
"fileId": {
|
||||
"__rl": true,
|
||||
"value": "123",
|
||||
"mode": "id"
|
||||
},
|
||||
"options": {
|
||||
"deletePermanently": true
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"typeVersion": 3,
|
||||
"position": [200, 0],
|
||||
"id": "file-delete",
|
||||
"name": "Delete File",
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "test-credential-id",
|
||||
"name": "Test Google Drive OAuth2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Delete File": [
|
||||
{
|
||||
"json": {
|
||||
"id": "123",
|
||||
"success": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking 'Execute Workflow'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Delete File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"name": "Google Drive V2 File Download Test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "trigger-id",
|
||||
"name": "When clicking 'Execute Workflow'"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "file",
|
||||
"operation": "download",
|
||||
"fileId": {
|
||||
"__rl": true,
|
||||
"value": "123",
|
||||
"mode": "id"
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"typeVersion": 3,
|
||||
"position": [200, 0],
|
||||
"id": "file-download",
|
||||
"name": "Download File",
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "test-credential-id",
|
||||
"name": "Test Google Drive OAuth2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Download File": [
|
||||
{
|
||||
"json": {}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking 'Execute Workflow'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Download File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"name": "Google Drive V2 File Move Test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "trigger-id",
|
||||
"name": "When clicking 'Execute Workflow'"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "file",
|
||||
"operation": "move",
|
||||
"fileId": {
|
||||
"__rl": true,
|
||||
"value": "123",
|
||||
"mode": "id"
|
||||
},
|
||||
"folderId": {
|
||||
"__rl": true,
|
||||
"value": "folder456",
|
||||
"mode": "id"
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"typeVersion": 3,
|
||||
"position": [200, 0],
|
||||
"id": "file-move",
|
||||
"name": "Move File",
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "test-credential-id",
|
||||
"name": "Test Google Drive OAuth2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Move File": [
|
||||
{
|
||||
"json": {
|
||||
"id": "123",
|
||||
"mimeType": "text/plain",
|
||||
"name": "Updated Test File"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking 'Execute Workflow'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Move File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"name": "Google Drive V2 File Share Test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "trigger-id",
|
||||
"name": "When clicking 'Execute Workflow'"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "file",
|
||||
"operation": "share",
|
||||
"fileId": {
|
||||
"__rl": true,
|
||||
"value": "123",
|
||||
"mode": "id"
|
||||
},
|
||||
"permissionsUi": {
|
||||
"permissionsValues": {
|
||||
"role": "reader",
|
||||
"type": "user",
|
||||
"emailAddress": "test@example.com"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"typeVersion": 3,
|
||||
"position": [200, 0],
|
||||
"id": "file-share",
|
||||
"name": "Share File",
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "test-credential-id",
|
||||
"name": "Test Google Drive OAuth2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Share File": [
|
||||
{
|
||||
"json": {
|
||||
"id": "permission123",
|
||||
"role": "reader",
|
||||
"type": "user"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking 'Execute Workflow'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Share File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"name": "Google Drive V2 File Update Test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "trigger-id",
|
||||
"name": "When clicking 'Execute Workflow'"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "file",
|
||||
"operation": "update",
|
||||
"fileId": {
|
||||
"__rl": true,
|
||||
"value": "123",
|
||||
"mode": "id"
|
||||
},
|
||||
"newUpdatedFileName": "Updated Test File"
|
||||
},
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"typeVersion": 3,
|
||||
"position": [200, 0],
|
||||
"id": "file-update",
|
||||
"name": "Update File",
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "test-credential-id",
|
||||
"name": "Test Google Drive OAuth2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Update File": [
|
||||
{
|
||||
"json": {
|
||||
"id": "123",
|
||||
"name": "Updated Test File",
|
||||
"mimeType": "text/plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking 'Execute Workflow'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Update File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"_comment": "This workflow tests basic file upload functionality with small embedded binary data. It uses the regular upload path (not resumable), as resumable uploads require binary data with an 'id' field which is not easily testable in workflow tests. Large file upload functionality is covered by dedicated unit tests.",
|
||||
"name": "Google Drive V2 File Upload Basic Test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "trigger-id",
|
||||
"name": "When clicking 'Execute Workflow'"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "file",
|
||||
"operation": "upload",
|
||||
"inputDataFieldName": "data",
|
||||
"name": "small-file.pdf"
|
||||
},
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"typeVersion": 3,
|
||||
"position": [200, 0],
|
||||
"id": "file-upload-basic",
|
||||
"name": "Upload Small File",
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "test-credential-id",
|
||||
"name": "Test Google Drive OAuth2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"When clicking 'Execute Workflow'": [
|
||||
{
|
||||
"json": {},
|
||||
"binary": {
|
||||
"data": {
|
||||
"data": "JVBERi0xLjQKJcfsj6IKNSAwIG9iago8PAovTGVuZ3RoIDYgMCBSCi9GaWx0ZXIgL0ZsYXRlRGVjb2RlCj4+CnN0cmVhbQp4nEWQwQrCMBBE",
|
||||
"mimeType": "application/pdf",
|
||||
"fileName": "small-file.pdf"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"Upload Small File": [
|
||||
{
|
||||
"json": {
|
||||
"id": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms",
|
||||
"name": "small-file.pdf",
|
||||
"mimeType": "application/pdf",
|
||||
"size": "81",
|
||||
"createdTime": "2024-01-01T00:00:00.000Z",
|
||||
"modifiedTime": "2024-01-01T00:00:00.000Z"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking 'Execute Workflow'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Upload Small File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"name": "Google Drive V2 File/Folder Search Test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "trigger-id",
|
||||
"name": "When clicking 'Execute Workflow'"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "fileFolder",
|
||||
"operation": "search",
|
||||
"searchMethod": "query",
|
||||
"queryString": "name contains 'test'"
|
||||
},
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"typeVersion": 3,
|
||||
"position": [200, 0],
|
||||
"id": "filefolder-search",
|
||||
"name": "Search Files and Folders",
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "test-credential-id",
|
||||
"name": "Test Google Drive OAuth2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Search Files and Folders": [
|
||||
{
|
||||
"json": {
|
||||
"id": "123",
|
||||
"name": "Test File",
|
||||
"mimeType": "text/plain"
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"id": "folder123",
|
||||
"name": "Test Folder",
|
||||
"mimeType": "application/vnd.google-apps.folder"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking 'Execute Workflow'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Search Files and Folders",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"name": "Google Drive V2 Folder Create Test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "trigger-id",
|
||||
"name": "When clicking 'Execute Workflow'"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "folder",
|
||||
"operation": "create",
|
||||
"name": "Test Folder"
|
||||
},
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"typeVersion": 3,
|
||||
"position": [200, 0],
|
||||
"id": "folder-create-basic",
|
||||
"name": "Create Folder",
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "test-credential-id",
|
||||
"name": "Test Google Drive OAuth2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Create Folder": [
|
||||
{
|
||||
"json": {
|
||||
"id": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms",
|
||||
"name": "Test Folder",
|
||||
"mimeType": "application/vnd.google-apps.folder",
|
||||
"createdTime": "2024-01-01T00:00:00.000Z",
|
||||
"modifiedTime": "2024-01-01T00:00:00.000Z",
|
||||
"webViewLink": "https://drive.google.com/drive/folders/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking 'Execute Workflow'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create Folder",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"name": "Google Drive V2 Folder Delete Test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "trigger-id",
|
||||
"name": "When clicking 'Execute Workflow'"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "folder",
|
||||
"operation": "deleteFolder",
|
||||
"folderNoRootId": {
|
||||
"__rl": true,
|
||||
"value": "folder123",
|
||||
"mode": "id"
|
||||
},
|
||||
"options": {
|
||||
"deletePermanently": true
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"typeVersion": 3,
|
||||
"position": [200, 0],
|
||||
"id": "folder-delete",
|
||||
"name": "Delete Folder",
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "test-credential-id",
|
||||
"name": "Test Google Drive OAuth2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Delete Folder": [
|
||||
{
|
||||
"json": {
|
||||
"fileId": "folder123",
|
||||
"success": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking 'Execute Workflow'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Delete Folder",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"name": "Google Drive V2 Folder Share Test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "trigger-id",
|
||||
"name": "When clicking 'Execute Workflow'"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "folder",
|
||||
"operation": "share",
|
||||
"folderNoRootId": {
|
||||
"__rl": true,
|
||||
"value": "folder123",
|
||||
"mode": "id"
|
||||
},
|
||||
"permissionsUi": {
|
||||
"permissionsValues": {
|
||||
"role": "reader",
|
||||
"type": "user",
|
||||
"emailAddress": "test@example.com"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"typeVersion": 3,
|
||||
"position": [200, 0],
|
||||
"id": "folder-share",
|
||||
"name": "Share Folder",
|
||||
"credentials": {
|
||||
"googleDriveOAuth2Api": {
|
||||
"id": "test-credential-id",
|
||||
"name": "Test Google Drive OAuth2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Share Folder": [
|
||||
{
|
||||
"json": {
|
||||
"id": "permission123",
|
||||
"role": "reader",
|
||||
"type": "user"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking 'Execute Workflow'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Share Folder",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user