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,74 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
describe('AWS Cognito - Add User to Group', () => {
|
||||
beforeEach(() => {
|
||||
const baseUrl = 'https://cognito-idp.eu-central-1.amazonaws.com/';
|
||||
|
||||
nock(baseUrl)
|
||||
.persist()
|
||||
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
|
||||
.post('/', {
|
||||
UserPoolId: 'eu-central-1_W3WwpiBXV',
|
||||
})
|
||||
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.DescribeUserPool')
|
||||
.reply(200, {
|
||||
UserPool: {
|
||||
Arn: 'arn:aws:cognito-idp:eu-central-1:130450532146:userpool/eu-central-1_W3WwpiBXV',
|
||||
CreationDate: 1739530218.869,
|
||||
DeletionProtection: 'INACTIVE',
|
||||
EstimatedNumberOfUsers: 4,
|
||||
Id: 'eu-central-1_W3WwpiBXV',
|
||||
LastModifiedDate: 1739530218.869,
|
||||
MfaConfiguration: 'OFF',
|
||||
Name: 'UserPoolSimple',
|
||||
},
|
||||
});
|
||||
|
||||
nock(baseUrl)
|
||||
.persist()
|
||||
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
|
||||
.post('/', {
|
||||
UserPoolId: 'eu-central-1_W3WwpiBXV',
|
||||
Filter: 'sub = "0394e8e2-5081-7020-06bd-44bdfc84dd10"',
|
||||
})
|
||||
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.ListUsers')
|
||||
.reply(200, {
|
||||
Users: [
|
||||
{
|
||||
Username: '0394e8e2-5081-7020-06bd-44bdfc84dd10',
|
||||
Attributes: [
|
||||
{ Name: 'email', Value: 'UserSimple' },
|
||||
{ Name: 'Sub', Value: '0394e8e2-5081-7020-06bd-44bdfc84dd10' },
|
||||
{ Name: 'Enabled', Value: true },
|
||||
{ Name: 'UserCreateDate', Value: 1736343033.226 },
|
||||
{ Name: 'UserLastModifiedDate', Value: 1736343033.226 },
|
||||
{ Name: 'UserStatus', Value: 'FORCE_CHANGE_PASSWORD' },
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
nock(baseUrl)
|
||||
.persist()
|
||||
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
|
||||
.post('/', {
|
||||
UserPoolId: 'eu-central-1_W3WwpiBXV',
|
||||
Username: '0394e8e2-5081-7020-06bd-44bdfc84dd10',
|
||||
GroupName: 'MyNewGroupSimple',
|
||||
})
|
||||
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.AdminAddUserToGroup')
|
||||
.reply(200, {});
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
workflowFiles: ['addToGroup.workflow.json'],
|
||||
credentials: {
|
||||
aws: {
|
||||
region: 'eu-central-1',
|
||||
accessKeyId: 'test',
|
||||
secretAccessKey: 'test',
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [-80, -100],
|
||||
"id": "7da2ce49-9a9d-4240-b082-ff1b12d101b1",
|
||||
"name": "When clicking ‘Execute workflow’"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "addToGroup",
|
||||
"userPool": {
|
||||
"__rl": true,
|
||||
"value": "eu-central-1_W3WwpiBXV",
|
||||
"mode": "list",
|
||||
"cachedResultName": "UserPoolSimple"
|
||||
},
|
||||
"user": {
|
||||
"__rl": true,
|
||||
"value": "0394e8e2-5081-7020-06bd-44bdfc84dd10",
|
||||
"mode": "list",
|
||||
"cachedResultName": "UserSimple"
|
||||
},
|
||||
"group": {
|
||||
"__rl": true,
|
||||
"value": "MyNewGroupSimple",
|
||||
"mode": "list",
|
||||
"cachedResultName": "MyNewGroupSimple"
|
||||
},
|
||||
"requestOptions": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.awsCognito",
|
||||
"typeVersion": 1,
|
||||
"position": [100, -100],
|
||||
"id": "0accb395-3cdb-4c3f-8adc-1a47567c37b5",
|
||||
"name": "AWS Cognito",
|
||||
"credentials": {
|
||||
"aws": {
|
||||
"id": "testId",
|
||||
"name": "AWS account Central Europe"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"When clicking ‘Execute workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "AWS Cognito",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"pinData": {
|
||||
"AWS Cognito": [
|
||||
{
|
||||
"json": {
|
||||
"addedToGroup": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
describe('AWS Cognito - Create User', () => {
|
||||
beforeEach(() => {
|
||||
const baseUrl = 'https://cognito-idp.eu-central-1.amazonaws.com/';
|
||||
nock(baseUrl)
|
||||
.persist()
|
||||
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
|
||||
.post('/', {
|
||||
UserPoolId: 'eu-central-1_W3WwpiBXV',
|
||||
})
|
||||
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.DescribeUserPool')
|
||||
.reply(200, {
|
||||
UserPool: {
|
||||
Id: 'eu-central-1_W3WwpiBXV',
|
||||
Name: 'MyUserPool',
|
||||
CreationDate: 1627891230,
|
||||
},
|
||||
});
|
||||
|
||||
nock(baseUrl)
|
||||
.persist()
|
||||
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
|
||||
.post('/', {
|
||||
UserPoolId: 'eu-central-1_W3WwpiBXV',
|
||||
Username: 'Johnn12',
|
||||
})
|
||||
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.AdminCreateUser')
|
||||
.reply(200, {
|
||||
User: {
|
||||
Username: 'Johnn12',
|
||||
UserStatus: 'FORCE_CHANGE_PASSWORD',
|
||||
Attributes: [
|
||||
{
|
||||
Name: 'sub',
|
||||
Value: '03d43812-00c1-7098-075e-8a535fdefc1b',
|
||||
},
|
||||
],
|
||||
UserCreateDate: 1743068750.761,
|
||||
UserLastModifiedDate: 1743068750.761,
|
||||
Enabled: true,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
workflowFiles: ['create.workflow.json'],
|
||||
credentials: {
|
||||
aws: {
|
||||
region: 'eu-central-1',
|
||||
accessKeyId: 'test',
|
||||
secretAccessKey: 'test',
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [260, 360],
|
||||
"id": "9ed2b86b-7c24-4ea0-a328-92d9e6dba35a",
|
||||
"name": "When clicking ‘Execute workflow’"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "create",
|
||||
"userPool": {
|
||||
"__rl": true,
|
||||
"value": "eu-central-1_W3WwpiBXV",
|
||||
"mode": "list",
|
||||
"cachedResultName": "UserPoolSimple"
|
||||
},
|
||||
"newUserName": "Johnn12",
|
||||
"additionalFields": {},
|
||||
"requestOptions": {}
|
||||
},
|
||||
"id": "ea53747b-2354-486c-9a9d-bac3dd88bacb",
|
||||
"name": "createUser",
|
||||
"type": "n8n-nodes-base.awsCognito",
|
||||
"typeVersion": 1,
|
||||
"position": [460, 360],
|
||||
"alwaysOutputData": true,
|
||||
"credentials": {
|
||||
"aws": {
|
||||
"id": "testId",
|
||||
"name": "AWS account Central Europe"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"createUser": [
|
||||
{
|
||||
"json": {
|
||||
"Attributes": [
|
||||
{
|
||||
"Name": "sub",
|
||||
"Value": "03d43812-00c1-7098-075e-8a535fdefc1b"
|
||||
}
|
||||
],
|
||||
"Enabled": true,
|
||||
"UserCreateDate": 1743068750.761,
|
||||
"UserLastModifiedDate": 1743068750.761,
|
||||
"UserStatus": "FORCE_CHANGE_PASSWORD",
|
||||
"Username": "Johnn12"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking ‘Execute workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "createUser",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
describe('AWS Cognito - Delete User', () => {
|
||||
beforeEach(() => {
|
||||
const baseUrl = 'https://cognito-idp.eu-central-1.amazonaws.com/';
|
||||
nock(baseUrl)
|
||||
.persist()
|
||||
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
|
||||
.post('/', {
|
||||
UserPoolId: 'eu-central-1_EUZ4iEF1T',
|
||||
})
|
||||
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.DescribeUserPool')
|
||||
.reply(200, {
|
||||
UserPool: {
|
||||
Arn: 'arn:aws:cognito-idp:eu-central-1:130450532146:userpool/eu-central-1_EUZ4iEF1T',
|
||||
CreationDate: 1739530218.869,
|
||||
DeletionProtection: 'INACTIVE',
|
||||
EstimatedNumberOfUsers: 4,
|
||||
Id: 'eu-central-1_EUZ4iEF1T',
|
||||
LastModifiedDate: 1739530218.869,
|
||||
MfaConfiguration: 'OFF',
|
||||
Name: 'UserPoolTwo',
|
||||
},
|
||||
});
|
||||
|
||||
nock(baseUrl)
|
||||
.persist()
|
||||
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
|
||||
.post('/', {
|
||||
UserPoolId: 'eu-central-1_EUZ4iEF1T',
|
||||
Filter: 'sub = "53c4f8c2-c071-707b-debd-d45585618da0"',
|
||||
})
|
||||
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.ListUsers')
|
||||
.reply(200, {
|
||||
Users: [
|
||||
{
|
||||
Username: '53c4f8c2-c071-707b-debd-d45585618da0',
|
||||
Attributes: [
|
||||
{ Name: 'email', Value: 'UserSimple' },
|
||||
{ Name: 'Sub', Value: '53c4f8c2-c071-707b-debd-d45585618da0' },
|
||||
{ Name: 'Enabled', Value: true },
|
||||
{ Name: 'UserCreateDate', Value: 1736343033.226 },
|
||||
{ Name: 'UserLastModifiedDate', Value: 1736343033.226 },
|
||||
{ Name: 'UserStatus', Value: 'FORCE_CHANGE_PASSWORD' },
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
nock(baseUrl)
|
||||
.persist()
|
||||
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
|
||||
.post('/', {
|
||||
UserPoolId: 'eu-central-1_EUZ4iEF1T',
|
||||
Username: '53c4f8c2-c071-707b-debd-d45585618da0',
|
||||
})
|
||||
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.AdminDeleteUser')
|
||||
.reply(200, {
|
||||
Message: 'User successfully deleted',
|
||||
});
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
workflowFiles: ['delete.workflow.json'],
|
||||
credentials: {
|
||||
aws: {
|
||||
region: 'eu-central-1',
|
||||
accessKeyId: 'test',
|
||||
secretAccessKey: 'test',
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [-80, -100],
|
||||
"id": "7da2ce49-9a9d-4240-b082-ff1b12d101b1",
|
||||
"name": "When clicking ‘Execute workflow’"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "delete",
|
||||
"userPool": {
|
||||
"__rl": true,
|
||||
"value": "eu-central-1_EUZ4iEF1T",
|
||||
"mode": "list",
|
||||
"cachedResultName": "UserPoolTwo"
|
||||
},
|
||||
"user": {
|
||||
"__rl": true,
|
||||
"value": "53c4f8c2-c071-707b-debd-d45585618da0",
|
||||
"mode": "list",
|
||||
"cachedResultName": "userName12"
|
||||
},
|
||||
"requestOptions": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.awsCognito",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 40],
|
||||
"id": "bc3483ef-4922-4759-a51d-12e5bd996628",
|
||||
"name": "AWS Cognito",
|
||||
"credentials": {
|
||||
"aws": {
|
||||
"id": "testId",
|
||||
"name": "AWS account Central Europe"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"When clicking ‘Execute workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "AWS Cognito",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"pinData": {
|
||||
"AWS Cognito": [
|
||||
{
|
||||
"json": {
|
||||
"deleted": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
describe('AWS Cognito - Get User', () => {
|
||||
beforeEach(() => {
|
||||
const baseUrl = 'https://cognito-idp.eu-central-1.amazonaws.com/';
|
||||
|
||||
nock(baseUrl)
|
||||
.persist()
|
||||
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
|
||||
.post('/', {
|
||||
UserPoolId: 'eu-central-1_EUZ4iEF1T',
|
||||
})
|
||||
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.DescribeUserPool')
|
||||
.reply(200, {
|
||||
UserPool: {
|
||||
Arn: 'arn:aws:cognito-idp:eu-central-1:130450532146:userpool/eu-central-1_EUZ4iEF1T',
|
||||
CreationDate: 1739530218.869,
|
||||
DeletionProtection: 'INACTIVE',
|
||||
EstimatedNumberOfUsers: 4,
|
||||
Id: 'eu-central-1_EUZ4iEF1T',
|
||||
LastModifiedDate: 1739530218.869,
|
||||
MfaConfiguration: 'OFF',
|
||||
Name: 'UserPoolSimple',
|
||||
},
|
||||
});
|
||||
|
||||
nock(baseUrl)
|
||||
.persist()
|
||||
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
|
||||
.post('/', {
|
||||
UserPoolId: 'eu-central-1_EUZ4iEF1T',
|
||||
Filter: 'sub = "b30498c2-d0f1-70a8-4b0c-3da25a3b998f"',
|
||||
})
|
||||
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.ListUsers')
|
||||
.reply(200, {
|
||||
Users: [
|
||||
{
|
||||
Username: 'userName10',
|
||||
UserAttributes: [
|
||||
{ Name: 'sub', Value: 'b30498c2-d0f1-70a8-4b0c-3da25a3b998f' },
|
||||
{ Name: 'family_name', Value: 'New FamilyName 2' },
|
||||
],
|
||||
UserCreateDate: 1744206331.569,
|
||||
UserLastModifiedDate: 1744206366.034,
|
||||
Enabled: true,
|
||||
UserStatus: 'FORCE_CHANGE_PASSWORD',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
nock(baseUrl)
|
||||
.persist()
|
||||
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
|
||||
.post('/', {
|
||||
UserPoolId: 'eu-central-1_EUZ4iEF1T',
|
||||
Username: 'userName10',
|
||||
})
|
||||
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.AdminGetUser')
|
||||
.reply(200, {
|
||||
Username: 'userName10',
|
||||
UserAttributes: [
|
||||
{ Name: 'sub', Value: 'b30498c2-d0f1-70a8-4b0c-3da25a3b998f' },
|
||||
{ Name: 'family_name', Value: 'New FamilyName 2' },
|
||||
],
|
||||
UserCreateDate: 1744206331.569,
|
||||
UserLastModifiedDate: 1744206366.034,
|
||||
Enabled: true,
|
||||
UserStatus: 'FORCE_CHANGE_PASSWORD',
|
||||
});
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
workflowFiles: ['get.workflow.json'],
|
||||
credentials: {
|
||||
aws: {
|
||||
region: 'eu-central-1',
|
||||
accessKeyId: 'test',
|
||||
secretAccessKey: 'test',
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "4570d7a2-f10a-495d-8a0e-8520b638649e",
|
||||
"name": "When clicking ‘Execute workflow’",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [-780, 380]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "get",
|
||||
"userPool": {
|
||||
"__rl": true,
|
||||
"value": "eu-central-1_EUZ4iEF1T",
|
||||
"mode": "list",
|
||||
"cachedResultName": "UserPoolTwo"
|
||||
},
|
||||
"user": {
|
||||
"__rl": true,
|
||||
"value": "b30498c2-d0f1-70a8-4b0c-3da25a3b998f",
|
||||
"mode": "list",
|
||||
"cachedResultName": "userName10"
|
||||
},
|
||||
"requestOptions": {}
|
||||
},
|
||||
"id": "2105b4ec-0db4-40f5-9d38-78c0fe20708f",
|
||||
"name": "getUser",
|
||||
"type": "n8n-nodes-base.awsCognito",
|
||||
"typeVersion": 1,
|
||||
"position": [-620, 500],
|
||||
"alwaysOutputData": true,
|
||||
"credentials": {
|
||||
"aws": {
|
||||
"id": "exampleId",
|
||||
"name": "AWS account Central Europe"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"When clicking ‘Execute workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "getUser",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"pinData": {
|
||||
"getUser": [
|
||||
{
|
||||
"json": {
|
||||
"Enabled": true,
|
||||
"UserCreateDate": 1744206331.569,
|
||||
"UserLastModifiedDate": 1744206366.034,
|
||||
"UserStatus": "FORCE_CHANGE_PASSWORD",
|
||||
"Username": "userName10",
|
||||
"family_name": "New FamilyName 2",
|
||||
"sub": "b30498c2-d0f1-70a8-4b0c-3da25a3b998f"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
describe('AWS Cognito - Get All Users', () => {
|
||||
beforeEach(() => {
|
||||
const baseUrl = 'https://cognito-idp.eu-central-1.amazonaws.com/';
|
||||
|
||||
nock(baseUrl)
|
||||
.persist()
|
||||
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
|
||||
.post('/', {
|
||||
UserPoolId: 'eu-central-1_KkXQgdCJv',
|
||||
})
|
||||
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.ListUsers')
|
||||
.reply(200, {
|
||||
Users: [
|
||||
{
|
||||
Username: '034448d2-4011-7079-9474-9a4fccd4247a',
|
||||
Attributes: [
|
||||
{ Name: 'email', Value: 'FinalUser@gmail.com' },
|
||||
{ Name: 'Sub', Value: '034448d2-4011-7079-9474-9a4fccd4247a' },
|
||||
{ Name: 'Enabled', Value: true },
|
||||
{ Name: 'UserCreateDate', Value: 1736343033.226 },
|
||||
{ Name: 'UserLastModifiedDate', Value: 1736343033.226 },
|
||||
{ Name: 'UserStatus', Value: 'FORCE_CHANGE_PASSWORD' },
|
||||
],
|
||||
},
|
||||
{
|
||||
Username: '03a438f2-10d1-70f1-f45a-09753ab5c4c3',
|
||||
Attributes: [
|
||||
{ Name: 'email', Value: 'mail.this1@gmail.com' },
|
||||
{ Name: 'Sub', Value: '03a438f2-10d1-70f1-f45a-09753ab5c4c3' },
|
||||
{ Name: 'Enabled', Value: true },
|
||||
{ Name: 'UserCreateDate', Value: 1733746687.223 },
|
||||
{ Name: 'UserLastModifiedDate', Value: 1733746687.223 },
|
||||
{ Name: 'UserStatus', Value: 'FORCE_CHANGE_PASSWORD' },
|
||||
],
|
||||
},
|
||||
{
|
||||
Username: '03f438d2-b0f1-70bc-04d9-f6dd31f2d878',
|
||||
Attributes: [
|
||||
{ Name: 'email', Value: 'test3@gmail.com' },
|
||||
{ Name: 'Sub', Value: '03f438d2-b0f1-70bc-04d9-f6dd31f2d878' },
|
||||
{ Name: 'Enabled', Value: true },
|
||||
{ Name: 'UserCreateDate', Value: 1742928785.796 },
|
||||
{ Name: 'UserLastModifiedDate', Value: 1742928785.796 },
|
||||
{ Name: 'UserStatus', Value: 'FORCE_CHANGE_PASSWORD' },
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
workflowFiles: ['getAll.workflow.json'],
|
||||
credentials: {
|
||||
aws: {
|
||||
region: 'eu-central-1',
|
||||
accessKeyId: 'test',
|
||||
secretAccessKey: 'test',
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [260, 360],
|
||||
"id": "9ed2b86b-7c24-4ea0-a328-92d9e6dba35a",
|
||||
"name": "When clicking ‘Execute workflow’"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"userPool": {
|
||||
"__rl": true,
|
||||
"value": "eu-central-1_KkXQgdCJv",
|
||||
"mode": "list",
|
||||
"cachedResultName": "AWS test"
|
||||
},
|
||||
"returnAll": true,
|
||||
"requestOptions": {}
|
||||
},
|
||||
"id": "e788623f-5d4a-4e76-b7f6-3e9389e2fe29",
|
||||
"name": "getAllUsers",
|
||||
"type": "n8n-nodes-base.awsCognito",
|
||||
"typeVersion": 1,
|
||||
"position": [460, 360],
|
||||
"alwaysOutputData": true,
|
||||
"credentials": {
|
||||
"aws": {
|
||||
"id": "testId",
|
||||
"name": "AWS account Central Europe"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"getAllUsers": [
|
||||
{
|
||||
"json": {
|
||||
"Enabled": true,
|
||||
"UserCreateDate": 1736343033.226,
|
||||
"UserLastModifiedDate": 1736343033.226,
|
||||
"UserStatus": "FORCE_CHANGE_PASSWORD",
|
||||
"Username": "034448d2-4011-7079-9474-9a4fccd4247a",
|
||||
"email": "FinalUser@gmail.com",
|
||||
"Sub": "034448d2-4011-7079-9474-9a4fccd4247a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"Enabled": true,
|
||||
"UserCreateDate": 1733746687.223,
|
||||
"UserLastModifiedDate": 1733746687.223,
|
||||
"UserStatus": "FORCE_CHANGE_PASSWORD",
|
||||
"Username": "03a438f2-10d1-70f1-f45a-09753ab5c4c3",
|
||||
"email": "mail.this1@gmail.com",
|
||||
"Sub": "03a438f2-10d1-70f1-f45a-09753ab5c4c3"
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"Enabled": true,
|
||||
"UserCreateDate": 1742928785.796,
|
||||
"UserLastModifiedDate": 1742928785.796,
|
||||
"UserStatus": "FORCE_CHANGE_PASSWORD",
|
||||
"Username": "03f438d2-b0f1-70bc-04d9-f6dd31f2d878",
|
||||
"email": "test3@gmail.com",
|
||||
"Sub": "03f438d2-b0f1-70bc-04d9-f6dd31f2d878"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking ‘Execute workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "getAllUsers",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
describe('AWS Cognito - Remove User From Group', () => {
|
||||
beforeEach(() => {
|
||||
const baseUrl = 'https://cognito-idp.eu-central-1.amazonaws.com/';
|
||||
|
||||
nock(baseUrl)
|
||||
.persist()
|
||||
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
|
||||
.post('/', {
|
||||
UserPoolId: 'eu-central-1_W3WwpiBXV',
|
||||
})
|
||||
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.DescribeUserPool')
|
||||
.reply(200, {
|
||||
UserPool: {
|
||||
Arn: 'arn:aws:cognito-idp:eu-central-1:130450532146:userpool/eu-central-1_W3WwpiBXV',
|
||||
CreationDate: 1739530218.869,
|
||||
DeletionProtection: 'INACTIVE',
|
||||
EstimatedNumberOfUsers: 4,
|
||||
Id: 'eu-central-1_W3WwpiBXV',
|
||||
LastModifiedDate: 1739530218.869,
|
||||
MfaConfiguration: 'OFF',
|
||||
Name: 'UserPoolSimple',
|
||||
},
|
||||
});
|
||||
|
||||
nock(baseUrl)
|
||||
.persist()
|
||||
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
|
||||
.post('/', {
|
||||
UserPoolId: 'eu-central-1_W3WwpiBXV',
|
||||
Filter: 'sub = "0394e8e2-5081-7020-06bd-44bdfc84dd10"',
|
||||
})
|
||||
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.ListUsers')
|
||||
.reply(200, {
|
||||
Users: [
|
||||
{
|
||||
Username: '0394e8e2-5081-7020-06bd-44bdfc84dd10',
|
||||
Attributes: [
|
||||
{ Name: 'email', Value: 'UserSimple' },
|
||||
{ Name: 'Sub', Value: '0394e8e2-5081-7020-06bd-44bdfc84dd10' },
|
||||
{ Name: 'Enabled', Value: true },
|
||||
{ Name: 'UserCreateDate', Value: 1736343033.226 },
|
||||
{ Name: 'UserLastModifiedDate', Value: 1736343033.226 },
|
||||
{ Name: 'UserStatus', Value: 'FORCE_CHANGE_PASSWORD' },
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
nock(baseUrl)
|
||||
.persist()
|
||||
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
|
||||
.post('/', {
|
||||
UserPoolId: 'eu-central-1_W3WwpiBXV',
|
||||
Username: '0394e8e2-5081-7020-06bd-44bdfc84dd10',
|
||||
GroupName: 'MyNewGroupSimple',
|
||||
})
|
||||
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.AdminRemoveUserFromGroup')
|
||||
.reply(200, {});
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
workflowFiles: ['removeFromGroup.workflow.json'],
|
||||
credentials: {
|
||||
aws: {
|
||||
region: 'eu-central-1',
|
||||
accessKeyId: 'test',
|
||||
secretAccessKey: 'test',
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [-80, -100],
|
||||
"id": "7da2ce49-9a9d-4240-b082-ff1b12d101b1",
|
||||
"name": "When clicking ‘Execute workflow’"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "removeFromGroup",
|
||||
"userPool": {
|
||||
"__rl": true,
|
||||
"value": "eu-central-1_W3WwpiBXV",
|
||||
"mode": "list",
|
||||
"cachedResultName": "UserPoolSimple"
|
||||
},
|
||||
"user": {
|
||||
"__rl": true,
|
||||
"value": "0394e8e2-5081-7020-06bd-44bdfc84dd10",
|
||||
"mode": "list",
|
||||
"cachedResultName": "UserSimple"
|
||||
},
|
||||
"group": {
|
||||
"__rl": true,
|
||||
"value": "MyNewGroupSimple",
|
||||
"mode": "list",
|
||||
"cachedResultName": "MyNewGroupSimple"
|
||||
},
|
||||
"requestOptions": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.awsCognito",
|
||||
"typeVersion": 1,
|
||||
"position": [100, -100],
|
||||
"id": "0accb395-3cdb-4c3f-8adc-1a47567c37b5",
|
||||
"name": "AWS Cognito",
|
||||
"credentials": {
|
||||
"aws": {
|
||||
"id": "testId",
|
||||
"name": "AWS account Central Europe"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"When clicking ‘Execute workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "AWS Cognito",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"pinData": {
|
||||
"AWS Cognito": [
|
||||
{
|
||||
"json": {
|
||||
"removedFromGroup": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
describe('AWS Cognito - Update User', () => {
|
||||
beforeEach(() => {
|
||||
const baseUrl = 'https://cognito-idp.eu-central-1.amazonaws.com/';
|
||||
|
||||
nock(baseUrl)
|
||||
.persist()
|
||||
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
|
||||
.post('/', {
|
||||
UserPoolId: 'eu-central-1_EUZ4iEF1T',
|
||||
})
|
||||
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.DescribeUserPool')
|
||||
.reply(200, {
|
||||
UserPool: {
|
||||
Arn: 'arn:aws:cognito-idp:eu-central-1:130450532146:userpool/eu-central-1_EUZ4iEF1T',
|
||||
CreationDate: 1739530218.869,
|
||||
DeletionProtection: 'INACTIVE',
|
||||
EstimatedNumberOfUsers: 4,
|
||||
Id: 'eu-central-1_EUZ4iEF1T',
|
||||
LastModifiedDate: 1739530218.869,
|
||||
MfaConfiguration: 'OFF',
|
||||
Name: 'UserPoolTwo',
|
||||
},
|
||||
});
|
||||
|
||||
nock(baseUrl)
|
||||
.persist()
|
||||
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
|
||||
.post('/', {
|
||||
UserPoolId: 'eu-central-1_EUZ4iEF1T',
|
||||
Filter: 'sub = "43045822-80e1-70f6-582d-78ae7992e9d9"',
|
||||
})
|
||||
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.ListUsers')
|
||||
.reply(200, {
|
||||
Users: [
|
||||
{
|
||||
Username: '43045822-80e1-70f6-582d-78ae7992e9d9',
|
||||
Attributes: [
|
||||
{ Name: 'email', Value: 'UserSimple' },
|
||||
{ Name: 'Sub', Value: '43045822-80e1-70f6-582d-78ae7992e9d9' },
|
||||
{ Name: 'Enabled', Value: true },
|
||||
{ Name: 'UserCreateDate', Value: 1736343033.226 },
|
||||
{ Name: 'UserLastModifiedDate', Value: 1736343033.226 },
|
||||
{ Name: 'UserStatus', Value: 'FORCE_CHANGE_PASSWORD' },
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
nock(baseUrl)
|
||||
.persist()
|
||||
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
|
||||
.post('/', {
|
||||
UserPoolId: 'eu-central-1_EUZ4iEF1T',
|
||||
Username: '43045822-80e1-70f6-582d-78ae7992e9d9',
|
||||
UserAttributes: [
|
||||
{
|
||||
Name: 'address',
|
||||
Value: 'New',
|
||||
},
|
||||
],
|
||||
})
|
||||
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.AdminUpdateUserAttributes')
|
||||
.reply(200, {});
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
workflowFiles: ['update.workflow.json'],
|
||||
credentials: {
|
||||
aws: {
|
||||
region: 'eu-central-1',
|
||||
accessKeyId: 'test',
|
||||
secretAccessKey: 'test',
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [-80, -100],
|
||||
"id": "7da2ce49-9a9d-4240-b082-ff1b12d101b1",
|
||||
"name": "When clicking ‘Execute workflow’"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "update",
|
||||
"userPool": {
|
||||
"__rl": true,
|
||||
"value": "eu-central-1_EUZ4iEF1T",
|
||||
"mode": "list",
|
||||
"cachedResultName": "UserPoolTwo"
|
||||
},
|
||||
"user": {
|
||||
"__rl": true,
|
||||
"value": "43045822-80e1-70f6-582d-78ae7992e9d9",
|
||||
"mode": "list",
|
||||
"cachedResultName": "Johnn"
|
||||
},
|
||||
"userAttributes": {
|
||||
"attributes": [
|
||||
{
|
||||
"standardName": "address",
|
||||
"value": "New"
|
||||
}
|
||||
]
|
||||
},
|
||||
"requestOptions": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.awsCognito",
|
||||
"typeVersion": 1,
|
||||
"position": [120, -100],
|
||||
"id": "4c6bdeea-f863-4974-b3d6-7dfc04f78df3",
|
||||
"name": "AWS Cognito",
|
||||
"credentials": {
|
||||
"aws": {
|
||||
"id": "exampleId",
|
||||
"name": "AWS account Central Europe"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"When clicking ‘Execute workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "AWS Cognito",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"pinData": {
|
||||
"AWS Cognito": [
|
||||
{
|
||||
"json": {
|
||||
"updated": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user