Skip to content

Commit 5536a80

Browse files
author
Maxim Zaytsev
authored
add multifile test (microsoft#14182)
1 parent 6b213d4 commit 5536a80

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

Tasks/CUrlUploaderV2/Tests/L0.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,17 @@ describe('CUrlUploaderV2 Suite', function () {
4444

4545
done();
4646
});
47+
48+
it('run curl with multiple files', (done: Mocha.Done) => {
49+
const tp = path.join(__dirname, 'L0CurlGoodMultiFiles.js');
50+
const tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
51+
52+
tr.run();
53+
54+
assert(tr.invokedToolCount == 1, 'should have only run curl');
55+
assert(tr.stderr.length == 0, 'should not have written to stderr');
56+
assert(tr.succeeded, 'task should have succeeded');
57+
58+
done();
59+
});
4760
});
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import ma = require('azure-pipelines-task-lib/mock-answer');
2+
import tmrm = require('azure-pipelines-task-lib/mock-run');
3+
import path = require('path');
4+
5+
let taskPath = path.join(__dirname, '..', 'curluploader.js');
6+
let tr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath);
7+
8+
tr.setInput('files', '/some/path/file*');
9+
tr.setInput('username', 'user');
10+
tr.setInput('password', 'pass');
11+
tr.setInput('url', 'ftp://some.ftp.com/');
12+
tr.setInput('redirectStderr', 'true');
13+
14+
// provide answers for task mock
15+
let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
16+
"which": {
17+
"curl": "/usr/local/bin/curl",
18+
"node": "/usr/local/bin/node"
19+
},
20+
"exec": {
21+
"curl -T {/some/path/file1,/some/path/file2} ftp://some.ftp.com/ --stderr - -u user:pass": {
22+
"code": 0,
23+
"stdout": "curl output here"
24+
}
25+
},
26+
"find": {
27+
"/some/path": [
28+
"/some/path/file1",
29+
"/some/path/file2"
30+
]
31+
},
32+
"match": {
33+
"/some/path/file*": [
34+
"/some/path/file1",
35+
"/some/path/file2"
36+
]
37+
},
38+
};
39+
tr.setAnswers(a);
40+
41+
tr.run();

0 commit comments

Comments
 (0)