test(core): Skip SMTP tests if service unavailable (#3293)

This commit is contained in:
Iván Ovejero
2022-05-20 21:28:05 +02:00
committed by GitHub
parent 29ddac30d3
commit e7fa0ae883
3 changed files with 30 additions and 0 deletions

View File

@@ -27,6 +27,7 @@ let globalMemberRole: Role;
let globalOwnerRole: Role;
let workflowOwnerRole: Role;
let credentialOwnerRole: Role;
let isSmtpAvailable = false;
beforeAll(async () => {
app = utils.initTestServer({ endpointGroups: ['users'], applyAuth: true });
@@ -47,6 +48,8 @@ beforeAll(async () => {
utils.initTestTelemetry();
utils.initTestLogger();
isSmtpAvailable = await utils.isTestSmtpServiceAvailable();
});
beforeEach(async () => {
@@ -482,6 +485,8 @@ test('POST /users should fail if user management is disabled', async () => {
test(
'POST /users should email invites and create user shells but ignore existing',
async () => {
if (!isSmtpAvailable) utils.skipSmtpTest(expect);
const owner = await testDb.createUser({ globalRole: globalOwnerRole });
const member = await testDb.createUser({ globalRole: globalMemberRole });
const memberShell = await testDb.createUserShell(globalMemberRole);
@@ -534,6 +539,8 @@ test(
test(
'POST /users should fail with invalid inputs',
async () => {
if (!isSmtpAvailable) utils.skipSmtpTest(expect);
const owner = await testDb.createUser({ globalRole: globalOwnerRole });
const authOwnerAgent = utils.createAgent(app, { auth: true, user: owner });
@@ -563,6 +570,8 @@ test(
test(
'POST /users should ignore an empty payload',
async () => {
if (!isSmtpAvailable) utils.skipSmtpTest(expect);
const owner = await testDb.createUser({ globalRole: globalOwnerRole });
const authOwnerAgent = utils.createAgent(app, { auth: true, user: owner });