当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript TaskMockRunner.setInput方法代码示例

本文整理汇总了TypeScript中vsts-task-lib/mock-run.TaskMockRunner.setInput方法的典型用法代码示例。如果您正苦于以下问题:TypeScript TaskMockRunner.setInput方法的具体用法?TypeScript TaskMockRunner.setInput怎么用?TypeScript TaskMockRunner.setInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vsts-task-lib/mock-run.TaskMockRunner的用法示例。


在下文中一共展示了TaskMockRunner.setInput方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: require

import  * as ma from 'vsts-task-lib/mock-answer';
import * as tmrm from 'vsts-task-lib/mock-run';
import * as path from 'path';

let taskPath = path.join(__dirname, '..', 'nlbtask.js');
let tmr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath);

tmr.setInput('ConnectedServiceName', 'AzureRMSpn');
tmr.setInput("ResourceGroupName", "testRG");
tmr.setInput("LoadBalancer", "testLB");
tmr.setInput("Action", "Connect");
tmr.setInput("NICDetection", "AutoDetectNic");

process.env["ENDPOINT_AUTH_AzureRMSpn"] = "{\"parameters\":{\"serviceprincipalid\":\"spId\",\"serviceprincipalkey\":\"spKey\",\"tenantid\":\"tenant\"},\"scheme\":\"ServicePrincipal\"}";
process.env["ENDPOINT_DATA_AzureRMSpn_SUBSCRIPTIONNAME"] = "sName";
process.env["ENDPOINT_DATA_AzureRMSpn_SUBSCRIPTIONID"] =  "sId";
process.env["AZURE_HTTP_USER_AGENT"] = "TFS_useragent";
process.env["SYSTEM_DEFAULTWORKINGDIRECTORY"] =  "DefaultWorkingDirectory";
process.env["COMPUTERNAME"] = "test-vm";

var tl = require('vsts-task-lib/mock-task');
tmr.registerMock('./nlbazureutility', {
	getNetworkInterfacesInRG: function(SPN, endpointUrl, resourceGroupName) {
		return [
			{
			    "name": "test-nic1",
			    "id": "test-nic1-id",
			    "properties": {
			        "provisioningState": "Succeeded",
			        "ipConfigurations": [{
			            "name": "test-ipconfig1",
开发者ID:DarqueWarrior,项目名称:vsts-tasks,代码行数:31,代码来源:L0ConnectSuccess.ts

示例2:

import * as MockRun from "vsts-task-lib/mock-run";
import * as Path from "path";

let taskPath: string = Path.join(__dirname, "../../../Tasks/AddBuildTag/addBuildTag.js");
let taskMock: MockRun.TaskMockRunner = new MockRun.TaskMockRunner(taskPath);
taskMock.setInput("Tag", "BuildTagged");
taskMock.run();
开发者ID:andremarques023,项目名称:vsts-extensions,代码行数:7,代码来源:whenTagIsSetItShouldTagTheBuild.ts

示例3:

import * as ma from "vsts-task-lib/mock-answer";
import * as tmrm from "vsts-task-lib/mock-run";
import * as path from "path";

const
    TASK_PATH = path.join(__dirname, "..", "bower", "bowertask.js"),
    
    tmr = new tmrm.TaskMockRunner(TASK_PATH);

tmr.setInput("command", "install");
tmr.setInput("bowerjson", "bower.json");

tmr.setAnswers({
    which: {
        "bower": "/bin/bower"
    },
    exist: {
        "/bin/bower": true
    },
    exec: {
        "/bin/bower install --config.interactive=false": {
            code: 0,
            stdout: "[MOCK] Bower installation done!"
        }
    }
});

tmr.run();
开发者ID:touchifyapp,项目名称:vsts-bower,代码行数:28,代码来源:21-no-bowerjson.ts

示例4: require

import  * as ma from 'vsts-task-lib/mock-answer';
import * as tmrm from 'vsts-task-lib/mock-run';
import * as path from 'path';

let taskPath = path.join(__dirname, '..', 'nlbtask.js');
let tmr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath);

tmr.setInput('ConnectedServiceName', 'AzureRMSpn');
tmr.setInput("ResourceGroupName", "testRG");
tmr.setInput("LoadBalancer", "testLB");
tmr.setInput("Action", "Disconnect");

process.env["ENDPOINT_AUTH_AzureRMSpn"] = "{\"parameters\":{\"serviceprincipalid\":\"spId\",\"serviceprincipalkey\":\"spKey\",\"tenantid\":\"tenant\"},\"scheme\":\"ServicePrincipal\"}";
process.env["ENDPOINT_DATA_AzureRMSpn_SUBSCRIPTIONNAME"] = "sName";
process.env["ENDPOINT_DATA_AzureRMSpn_SUBSCRIPTIONID"] =  "sId";
process.env["AZURE_HTTP_USER_AGENT"] = "TFS_useragent";
process.env["SYSTEM_DEFAULTWORKINGDIRECTORY"] =  "DefaultWorkingDirectory";
process.env["COMPUTERNAME"] = "test-vm";

var tl = require('vsts-task-lib/mock-task');
tmr.registerMock('./nlbazureutility', {
	getNetworkInterfacesInRG: function(SPN, endpointUrl, resourceGroupName) {
		return [
			{
			    "name": "test-nic1",
			    "id": "test-nic1-id",
			    "properties": {
			        "provisioningState": "Succeeded",
			        "ipConfigurations": [{
			            "name": "test-ipconfig1",
			            "id":"test-ipconfig1-id",
开发者ID:DarqueWarrior,项目名称:vsts-tasks,代码行数:31,代码来源:L0TaskFailSetNetworkInterface.ts

示例5:

import * as MockRun from "vsts-task-lib/mock-run";
import * as Path from "path";

let taskPath: string = Path.join(__dirname, "../../../Tasks/SetVariable/setVariable.js");
let taskMock: MockRun.TaskMockRunner = new MockRun.TaskMockRunner(taskPath);
taskMock.setInput("name", "TaskVariable");
taskMock.setInput("value", "AnyValue")
taskMock.run();
开发者ID:andremarques023,项目名称:vsts-extensions,代码行数:8,代码来源:whenValueIsSetItShouldSetValue.ts

示例6: TaskMockRunner

import * as path from 'path';

import { TaskMockRunner } from 'vsts-task-lib/mock-run';

const taskPath = path.join(__dirname, '..', 'main.js');
const taskRunner = new TaskMockRunner(taskPath);

taskRunner.setInput('versionSpec', '3.x');
taskRunner.setInput('addToPath', 'false');
taskRunner.setInput('architecture', 'x64');

// Mock vsts-task-tool-lib
const toolPath = path.join('/', 'Python', '3.6.4', 'x64');
taskRunner.registerMock('vsts-task-tool-lib/tool', {
    findLocalTool: () => toolPath
});

taskRunner.run();
开发者ID:bleissem,项目名称:vsts-tasks,代码行数:18,代码来源:L0SucceedsWhenVersionIsFound.ts

示例7: TaskMockRunner

import * as path from 'path';

import * as mockery from 'mockery';

import { TaskMockRunner } from 'vsts-task-lib/mock-run';

const taskPath = path.join(__dirname, '..', 'main.js');
const taskRunner = new TaskMockRunner(taskPath);

taskRunner.setInput('createCustomEnvironment', 'true');
taskRunner.setInput('environmentName', 'test');

// Mock vsts-task-lib
taskRunner.setAnswers({
    which: {
        'conda': '/miniconda/bin/conda'
    },
    exec: {
        'sudo /miniconda/bin/conda create --quiet --prefix /miniconda/envs/test --mkdir --yes': {
            code: 0
        },
        'conda create --quiet --prefix \\miniconda\\envs\\test --mkdir --yes': {
            code: 0
        },
    }
});

// Mock vsts-task-tool-lib
taskRunner.registerMock('vsts-task-tool-lib/tool', {
    prependPath: () => undefined,
});
开发者ID:shubham90,项目名称:vsts-tasks,代码行数:31,代码来源:L0CreateEnvironment.ts

示例8: require

import * as path from "path";
import * as mocks from "./L0Mocks";
import { TaskMockRunner } from "vsts-task-lib/mock-run";
var nock = require("nock");

let tmr: TaskMockRunner = new TaskMockRunner(path.join(__dirname, '..', 'azuremonitoralerts.js'));

tmr.setInput("ConnectedServiceName", "azureRMSpn");
tmr.setInput("ResourceGroupName", "testRg");
tmr.setInput("ResourceType", "testResource.provider/type");
tmr.setInput("ResourceName", "testResourceName");
tmr.setInput("AlertRules", JSON.stringify(mocks.mockAlertRules));
tmr.setInput("NotifyServiceOwners", "true");
tmr.setInput("NotifyEmails", "abc@d.com; ;    ; def@g.com     ;");

nock("http://example.com", {
		reqheaders: {
        	'authorization': 'Bearer accessToken',
        	"accept": "application/json",
    		"user-agent": "TFS_useragent"
      	}
	})
	.get(/\/subscriptions\/sId\/resourceGroups\/testRg\/providers\/Microsoft.insights\/alertrules\/Rule1/)
	.query({"api-version": "2016-03-01"})
	.reply(200, {
		location: "alertrulelocation",
		properties: {
			condition: {
				dataSource: {
					"$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource, Microsoft.WindowsAzure.Management.Mon.Client",
            		"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
开发者ID:bleissem,项目名称:vsts-tasks,代码行数:31,代码来源:L0AlertRuleWithEmailSuccess.ts

示例9:

import * as ma from "vsts-task-lib/mock-answer";
import * as tmrm from "vsts-task-lib/mock-run";
import * as path from "path";

const
    TASK_PATH = path.join(__dirname, "..", "bower", "bowertask.js"),
    
    tmr = new tmrm.TaskMockRunner(TASK_PATH);

tmr.setInput("bowerjson", "bower.json");

tmr.setAnswers({
    which: {
        "bower": "/bin/bower"
    },
    exist: {
        "/bin/bower": true
    },
    checkPath: {
        "bower.json": true
    },
    exec: {
        "/bin/bower install --config.interactive=false": {
            code: 0,
            stdout: "[MOCK] Bower installation done!"
        }
    }
});

tmr.run();
开发者ID:touchifyapp,项目名称:vsts-bower,代码行数:30,代码来源:20-no-command.ts


注:本文中的vsts-task-lib/mock-run.TaskMockRunner.setInput方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。