Skip to content

Commit 105aafe

Browse files
amp-powellAbby Powell
andauthored
Update TwineAuthenticateV1 to allow multiple connections (#20187)
* Update TwineAuthenticateV1 to allow multiple connections * Using tl.setResult instead of console.log * Handling feed names with '.' and updated tests * Updated how repos are added to .pypirc to be careful with special characters * Printing success statement * Added check to see if repo uri is already used * Changed whitespace of resource strings to match generated files --------- Co-authored-by: Abby Powell <[email protected]>
1 parent 1df90bf commit 105aafe

File tree

21 files changed

+2989
-1262
lines changed

21 files changed

+2989
-1262
lines changed

Tasks/TwineAuthenticateV1/Strings/resources.resjson/en-US/resources.resjson

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,8 @@
2323
"loc.messages.FailedToAddAuthentication": "Failed to add authentication.",
2424
"loc.messages.NoPypircFile": "No .pypirc file to clean up.",
2525
"loc.messages.VariableSetForPypirc": "Environment variable for .pypirc at %s is set.",
26-
"loc.messages.Info_RemovingPypircFile": "Removing .pypirc file from %s"
26+
"loc.messages.Info_RemovingPypircFile": "Removing .pypirc file from %s",
27+
"loc.messages.DuplicateRegistry": "%s registry is already authenticated",
28+
"loc.messages.NoRepoFound": "No repo url found under %s",
29+
"loc.messages.DuplicateRepoUrl": "Repo with repository url %s already exists and is authenticated"
2730
}

Tasks/TwineAuthenticateV1/Tests/L0.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ describe('Twine Authenticate V1 Suite', function () {
3232
assert.strictEqual(lines[0], "[distutils]");
3333
assert.strictEqual(lines[1], "index-servers=TestFeed",
3434
"Test Feed should be added to auth list.");
35-
assert.strictEqual(lines[2], "[TestFeed]");
36-
assert.strictEqual(lines[3], "repository=https://vsts/packagesource/TestFeed",
35+
assert.strictEqual(lines[3], "[TestFeed]");
36+
assert.strictEqual(lines[4], "repository=https://vsts/packagesource/TestFeed",
3737
"Test Feed repository should be correct.");
38-
assert.strictEqual(lines[4], "username=build",
38+
assert.strictEqual(lines[5], "username=build",
3939
"Default username should be correct.");
40-
assert.strictEqual(lines[5], "password=token",
40+
assert.strictEqual(lines[6], "password=token",
4141
"Default password from environment variable should be correct.");
4242

4343
done();
@@ -57,14 +57,15 @@ describe('Twine Authenticate V1 Suite', function () {
5757
let lines = fileContent.split(/\r?\n/);
5858

5959
assert.strictEqual(lines[0], "[distutils]");
60-
assert.strictEqual(lines[1], "index-servers=Test.Feed",
61-
"Test Feed should be added to auth list.");
62-
assert.strictEqual(lines[2], "[Test.Feed]");
63-
assert.strictEqual(lines[3], "repository=https://vsts/packagesource/Test.Feed",
60+
assert((lines[1] === "index-servers=Test.Feed")
61+
|| (lines[1].startsWith('index-servers=') && lines[1].endsWith('Test.Feed')),
62+
"Test Feed should be added to auth list.");
63+
assert.strictEqual(lines.at(-6), "[Test.Feed]");
64+
assert.strictEqual(lines.at(-5), "repository=https://vsts/packagesource/Test.Feed",
6465
"Test Feed repository should be correct.");
65-
assert.strictEqual(lines[4], "username=build",
66+
assert.strictEqual(lines.at(-4), "username=build",
6667
"Default username should be correct.");
67-
assert.strictEqual(lines[5], "password=token",
68+
assert.strictEqual(lines.at(-3), "password=token",
6869
"Default password from environment variable should be correct.");
6970

7071
done();

0 commit comments

Comments
 (0)