|
|
@ -30,10 +30,11 @@ describe('POST /integration with missing or wrong data', () => { |
|
|
|
let agent = await init(); |
|
|
|
let agent = await init(); |
|
|
|
let req = agent.keepOpen(); |
|
|
|
let req = agent.keepOpen(); |
|
|
|
try { |
|
|
|
try { |
|
|
|
await helpers.createIntegration(req, { name: "A", type: IntegrationType.spotify }, 400); |
|
|
|
await helpers.createIntegration(req, { type: IntegrationType.SpotifyClientCredentials, details: {}, secretDetails: {} }, 400); |
|
|
|
await helpers.createIntegration(req, { details: {}, type: IntegrationType.spotify }, 400); |
|
|
|
await helpers.createIntegration(req, { name: "A", details: {}, secretDetails: {} }, 400); |
|
|
|
await helpers.createIntegration(req, { name: "A", details: {} }, 400); |
|
|
|
await helpers.createIntegration(req, { name: "A", type: IntegrationType.SpotifyClientCredentials, secretDetails: {} }, 400); |
|
|
|
await helpers.createIntegration(req, { name: "A", type: "NonexistentType", details: {} }, 400); |
|
|
|
await helpers.createIntegration(req, { name: "A", type: IntegrationType.SpotifyClientCredentials, details: {}, }, 400); |
|
|
|
|
|
|
|
await helpers.createIntegration(req, { name: "A", type: "NonexistentType", details: {}, secretDetails: {} }, 400); |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
req.close(); |
|
|
|
req.close(); |
|
|
|
agent.close(); |
|
|
|
agent.close(); |
|
|
@ -47,7 +48,7 @@ describe('POST /integration with a correct request', () => { |
|
|
|
let agent = await init(); |
|
|
|
let agent = await init(); |
|
|
|
let req = agent.keepOpen(); |
|
|
|
let req = agent.keepOpen(); |
|
|
|
try { |
|
|
|
try { |
|
|
|
await helpers.createIntegration(req, { name: "A", type: IntegrationType.spotify, details: {} }, 200, { id: 1 }); |
|
|
|
await helpers.createIntegration(req, { name: "A", type: IntegrationType.SpotifyClientCredentials, details: {}, secretDetails: {} }, 200, { id: 1 }); |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
req.close(); |
|
|
|
req.close(); |
|
|
|
agent.close(); |
|
|
|
agent.close(); |
|
|
@ -61,9 +62,9 @@ describe('PUT /integration with a correct request', () => { |
|
|
|
let agent = await init(); |
|
|
|
let agent = await init(); |
|
|
|
let req = agent.keepOpen(); |
|
|
|
let req = agent.keepOpen(); |
|
|
|
try { |
|
|
|
try { |
|
|
|
await helpers.createIntegration(req, { name: "A", type: IntegrationType.spotify, details: {} }, 200, { id: 1 }); |
|
|
|
await helpers.createIntegration(req, { name: "A", type: IntegrationType.SpotifyClientCredentials, details: {}, secretDetails: {} }, 200, { id: 1 }); |
|
|
|
await helpers.modifyIntegration(req, 1, { name: "B", type: IntegrationType.spotify, details: { secret: 'cat' } }, 200); |
|
|
|
await helpers.modifyIntegration(req, 1, { name: "B", type: IntegrationType.SpotifyClientCredentials, details: { secret: 'cat' }, secretDetails: {} }, 200); |
|
|
|
await helpers.checkIntegration(req, 1, 200, { name: "B", type: IntegrationType.spotify, details: { secret: 'cat' } }) |
|
|
|
await helpers.checkIntegration(req, 1, 200, { name: "B", type: IntegrationType.SpotifyClientCredentials, details: { secret: 'cat' } }) |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
req.close(); |
|
|
|
req.close(); |
|
|
|
agent.close(); |
|
|
|
agent.close(); |
|
|
@ -77,8 +78,8 @@ describe('PUT /integration with wrong data', () => { |
|
|
|
let agent = await init(); |
|
|
|
let agent = await init(); |
|
|
|
let req = agent.keepOpen(); |
|
|
|
let req = agent.keepOpen(); |
|
|
|
try { |
|
|
|
try { |
|
|
|
await helpers.createIntegration(req, { name: "A", type: IntegrationType.spotify, details: {} }, 200, { id: 1 }); |
|
|
|
await helpers.createIntegration(req, { name: "A", type: IntegrationType.SpotifyClientCredentials, details: {}, secretDetails: {} }, 200, { id: 1 }); |
|
|
|
await helpers.modifyIntegration(req, 1, { name: "B", type: "UnknownType", details: {} }, 400); |
|
|
|
await helpers.modifyIntegration(req, 1, { name: "B", type: "UnknownType", details: {}, secretDetails: {} }, 400); |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
req.close(); |
|
|
|
req.close(); |
|
|
|
agent.close(); |
|
|
|
agent.close(); |
|
|
@ -92,8 +93,8 @@ describe('DELETE /integration with a correct request', () => { |
|
|
|
let agent = await init(); |
|
|
|
let agent = await init(); |
|
|
|
let req = agent.keepOpen(); |
|
|
|
let req = agent.keepOpen(); |
|
|
|
try { |
|
|
|
try { |
|
|
|
await helpers.createIntegration(req, { name: "A", type: IntegrationType.spotify, details: {} }, 200, { id: 1 }); |
|
|
|
await helpers.createIntegration(req, { name: "A", type: IntegrationType.SpotifyClientCredentials, details: {}, secretDetails: {} }, 200, { id: 1 }); |
|
|
|
await helpers.checkIntegration(req, 1, 200, { name: "A", type: IntegrationType.spotify, details: {} }) |
|
|
|
await helpers.checkIntegration(req, 1, 200, { name: "A", type: IntegrationType.SpotifyClientCredentials, details: {} }) |
|
|
|
await helpers.deleteIntegration(req, 1, 200); |
|
|
|
await helpers.deleteIntegration(req, 1, 200); |
|
|
|
await helpers.checkIntegration(req, 1, 404); |
|
|
|
await helpers.checkIntegration(req, 1, 404); |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
@ -109,13 +110,13 @@ describe('GET /integration list with a correct request', () => { |
|
|
|
let agent = await init(); |
|
|
|
let agent = await init(); |
|
|
|
let req = agent.keepOpen(); |
|
|
|
let req = agent.keepOpen(); |
|
|
|
try { |
|
|
|
try { |
|
|
|
await helpers.createIntegration(req, { name: "A", type: IntegrationType.spotify, details: {} }, 200, { id: 1 }); |
|
|
|
await helpers.createIntegration(req, { name: "A", type: IntegrationType.SpotifyClientCredentials, details: {}, secretDetails: {} }, 200, { id: 1 }); |
|
|
|
await helpers.createIntegration(req, { name: "B", type: IntegrationType.spotify, details: {} }, 200, { id: 2 }); |
|
|
|
await helpers.createIntegration(req, { name: "B", type: IntegrationType.SpotifyClientCredentials, details: {}, secretDetails: {} }, 200, { id: 2 }); |
|
|
|
await helpers.createIntegration(req, { name: "C", type: IntegrationType.spotify, details: {} }, 200, { id: 3 }); |
|
|
|
await helpers.createIntegration(req, { name: "C", type: IntegrationType.SpotifyClientCredentials, details: {}, secretDetails: {} }, 200, { id: 3 }); |
|
|
|
await helpers.listIntegrations(req, 200, [ |
|
|
|
await helpers.listIntegrations(req, 200, [ |
|
|
|
{ id: 1, name: "A", type: IntegrationType.spotify, details: {} }, |
|
|
|
{ id: 1, name: "A", type: IntegrationType.SpotifyClientCredentials, details: {} }, |
|
|
|
{ id: 2, name: "B", type: IntegrationType.spotify, details: {} }, |
|
|
|
{ id: 2, name: "B", type: IntegrationType.SpotifyClientCredentials, details: {} }, |
|
|
|
{ id: 3, name: "C", type: IntegrationType.spotify, details: {} }, |
|
|
|
{ id: 3, name: "C", type: IntegrationType.SpotifyClientCredentials, details: {} }, |
|
|
|
]); |
|
|
|
]); |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
req.close(); |
|
|
|
req.close(); |
|
|
|