-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NuGetCommand multipleServiceConnection L0
- Loading branch information
Peter Spillman
committed
Jun 13, 2017
1 parent
2c15f68
commit 707c8fe
Showing
3 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
Tasks/NuGetCommand/Tests/RestoreTests/multipleServiceConnections.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import ma = require('vsts-task-lib/mock-answer'); | ||
import tmrm = require('vsts-task-lib/mock-run'); | ||
import path = require('path'); | ||
import util = require('../NugetMockHelper'); | ||
|
||
let taskPath = path.join(__dirname, '../..', 'nugetcommandmain.js'); | ||
let tmr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath); | ||
let nmh: util.NugetMockHelper = new util.NugetMockHelper(tmr); | ||
|
||
process.env['ENDPOINT_URL_ENDPOINT1'] = "https://endpoint1.visualstudio.com/path"; | ||
process.env['ENDPOINT_AUTH_ENDPOINT1'] = "{\"parameters\":{\"apitoken\":\"mytoken123\"},\"scheme\":\"token\"}"; | ||
process.env["ENDPOINT_AUTH_SCHEME_ENDPOINT1"] = "token"; | ||
process.env['ENDPOINT_AUTH_PARAMETER_ENDPOINT1_APITOKEN'] = "mytoken123"; | ||
process.env['ENDPOINT_URL_ENDPOINT2'] = "https://endpoint2.visualstudio.com/path"; | ||
process.env['ENDPOINT_AUTH_ENDPOINT2'] = "{\"parameters\":{\"apitoken\":\"mytoken123\"},\"scheme\":\"token\"}"; | ||
process.env["ENDPOINT_AUTH_SCHEME_ENDPOINT2"] = "token"; | ||
process.env['ENDPOINT_AUTH_PARAMETER_ENDPOINT1_APITOKEN'] = "mytoken123"; | ||
|
||
nmh.setNugetVersionInputDefault(); | ||
tmr.setInput('command', 'restore'); | ||
tmr.setInput('solution', 'single.sln'); | ||
tmr.setInput('selectOrConfig', 'config'); | ||
tmr.setInput('nugetConfigPath', 'c:\\agent\\home\\directory\\nuget.config'); | ||
tmr.setInput('externalEndpoints', "ENDPOINT1,ENDPOINT2"); | ||
|
||
let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{ | ||
"osType": {}, | ||
"checkPath": { | ||
"c:\\agent\\home\\directory\\nuget.config": true, | ||
"c:\\agent\\home\\directory\\single.sln": true | ||
}, | ||
"which": {}, | ||
"exec": { | ||
"c:\\from\\tool\\installer\\nuget.exe restore c:\\agent\\home\\directory\\single.sln -NonInteractive -ConfigFile c:\\agent\\home\\directory\\tempNuGet_.config": { | ||
"code": 0, | ||
"stdout": "NuGet output here", | ||
"stderr": "" | ||
} | ||
}, | ||
"exist": {}, | ||
"stats": { | ||
"c:\\agent\\home\\directory\\single.sln": { | ||
"isFile": true | ||
} | ||
}, | ||
"rmRF": { | ||
"c:\\agent\\home\\directory\\tempNuGet_.config": { | ||
"success": true | ||
} | ||
}, | ||
"findMatch": { | ||
"single.sln" : ["c:\\agent\\home\\directory\\single.sln"] | ||
} | ||
}; | ||
nmh.setAnswers(a); | ||
|
||
nmh.registerNugetUtilityMock(["c:\\agent\\home\\directory\\single.sln"]); | ||
nmh.registerDefaultNugetVersionMock(); | ||
nmh.registerNugetConfigMock(); | ||
nmh.registerToolRunnerMock(); | ||
|
||
tmr.run(); |