Skip to content

Commit

Permalink
run mock auth tests without azure creds
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche committed Sep 16, 2020
1 parent 0919569 commit 286d7ed
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
4 changes: 4 additions & 0 deletions changelog/issue-3503.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
audience: developers
level: silent
reference: issue 3503
---
18 changes: 15 additions & 3 deletions services/auth/test/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ exports.withCfg = (mock, skipping) => {
return;
}
suiteSetup(async function() {
if (skipping()) {
return;
}

exports.cfg = await exports.load('cfg');

exports.load.save();
Expand All @@ -66,12 +70,20 @@ exports.withCfg = (mock, skipping) => {
description: 'testing',
})));

// override cfg.app.azureAccounts based on the azure secret
const sec = exports.secrets.get('azure');
exports.load.cfg('app.azureAccounts', { [sec.accountId]: sec.accessKey });
// override cfg.app.azureAccounts based on the azure secret, or mock it
if (mock) {
exports.load.cfg('app.azureAccounts', {});
} else {
const sec = exports.secrets.get('azure');
exports.load.cfg('app.azureAccounts', { [sec.accountId]: sec.accessKey });
}
});

suiteTeardown(async function() {
if (skipping()) {
return;
}

exports.load.restore();
});
};
Expand Down

0 comments on commit 286d7ed

Please sign in to comment.