Skip to content

Commit

Permalink
twineauthwenticateV0 mask auth, update dependency (#20268)
Browse files Browse the repository at this point in the history
  • Loading branch information
tintse-thxsky-MSFT authored Aug 9, 2024
1 parent eb3c17e commit 6672f17
Show file tree
Hide file tree
Showing 21 changed files with 1,441 additions and 1,572 deletions.
26 changes: 10 additions & 16 deletions Tasks/TwineAuthenticateV1/Tests/L0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as tl from "azure-pipelines-task-lib/task";

const tempDir = path.join(__dirname, "temp");

describe('Twine Authenticate V1 Suite', function () {
describe('Twine Authenticate V1 Suite', async () => {
before(() => {
tl.mkdirP(tempDir);
});
Expand All @@ -15,12 +15,11 @@ describe('Twine Authenticate V1 Suite', function () {
tl.rmRF(tempDir);
});

it('sets authentication for current organization feed', function (done: Mocha.Done) {
this.timeout(50000);
it('sets authentication for current organization feed', async () => {
let tp = path.join(__dirname, './setAuthInternalFeed.js')
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
await tr.runAsync();
assert(tr.invokedToolCount == 0, 'no tool should be invoked.');
assert(tr.succeeded, 'should have succeeded');
assert.strictEqual(tr.errorIssues.length, 0, "should have no errors");
Expand All @@ -39,16 +38,13 @@ describe('Twine Authenticate V1 Suite', function () {
"Default username should be correct.");
assert.strictEqual(lines[6], "password=token",
"Default password from environment variable should be correct.");
}).timeout(50000);

done();
});

it('sets authentication for current organization feed', (done: MochaDone) => {
this.timeout(10000);
it('sets authentication for current organization feed with dot', async () => {
let tp = path.join(__dirname, './setAuthInternalFeedWithDot.js')
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
await tr.runAsync();
assert(tr.invokedToolCount == 0, 'no tool should be invoked.');
assert(tr.succeeded, 'should have succeeded');
assert.strictEqual(tr.errorIssues.length, 0, "should have no errors");
Expand All @@ -57,17 +53,15 @@ describe('Twine Authenticate V1 Suite', function () {
let lines = fileContent.split(/\r?\n/);

assert.strictEqual(lines[0], "[distutils]");
assert((lines[1] === "index-servers=Test.Feed")
|| (lines[1].startsWith('index-servers=') && lines[1].endsWith('Test.Feed')),
"Test Feed should be added to auth list.");
assert((lines[1] === "index-servers=Test.Feed")
|| (lines[1].startsWith('index-servers=') && lines[1].endsWith('Test.Feed')),
"Test Feed should be added to auth list.");
assert.strictEqual(lines.at(-6), "[Test.Feed]");
assert.strictEqual(lines.at(-5), "repository=https://vsts/packagesource/Test.Feed",
"Test Feed repository should be correct.");
assert.strictEqual(lines.at(-4), "username=build",
"Default username should be correct.");
assert.strictEqual(lines.at(-3), "password=token",
"Default password from environment variable should be correct.");

done();
});
}).timeout(50000);
});
Loading

0 comments on commit 6672f17

Please sign in to comment.