Skip to content

Commit e7ec6f6

Browse files
committed
Merge pull request #251 from nodegit/cred-methods
Added more git_cred methods
2 parents 4113536 + 09d310e commit e7ec6f6

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ branches:
2323
only:
2424
- master
2525
script: npm --expose-gc test
26+
notifications:
27+
slack:
28+
secure: KglNSqZiid9YudCwkPFDh+sZfW5BwFlM70y67E4peHwwlbbV1sSBPHcs74ZHP/lqgEZ4hMv4N2NI58oYFD5/1a+tKIQP1TkdIMuq4j2LXheuirA2HDcydOVrsC8kRx5XFGKdVRg/uyX2dlRHcOWFhxrS6yc6IxtxYWlRTD2SmEc=

generate/descriptor.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,33 @@
284284
"isStruct": true,
285285
"cType": "git_cred",
286286
"functions": {
287+
"git_cred_default_new": {
288+
"ignore": false,
289+
"isPrototypeMethod": false,
290+
"args": [{ "isSelf": false }],
291+
"isAsync": false
292+
},
293+
"git_cred_has_username": {
294+
"ignore": false,
295+
"args": [{ "isSelf": true}]
296+
},
287297
"git_cred_ssh_key_from_agent": {
288298
"ignore": false,
289299
"isPrototypeMethod": false,
290300
"args": [{ "isSelf": false }],
291301
"isAsync": false
302+
},
303+
"git_cred_ssh_key_new": {
304+
"ignore": false,
305+
"isPrototypeMethod": false,
306+
"args": [{ "isSelf": false }],
307+
"isAsync": false
308+
},
309+
"git_cred_userpass_plaintext_new": {
310+
"ignore": false,
311+
"isPrototypeMethod": false,
312+
"args": [{ "isSelf": false }],
313+
"isAsync": false
292314
}
293315
}
294316
},

test/tests/cred.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
var assert = require("assert");
2+
3+
describe("Cred", function() {
4+
var NodeGit = require("../../");
5+
6+
it("can create default credentials", function() {
7+
var defaultCreds = NodeGit.Cred.defaultNew();
8+
9+
assert(defaultCreds instanceof NodeGit.Cred);
10+
});
11+
12+
it("can create ssh credentials using passed keys", function() {
13+
var sshCreds
14+
= NodeGit.Cred.sshKeyNew(
15+
"username",
16+
"public key",
17+
"private key",
18+
"passphrase");
19+
20+
assert(sshCreds instanceof NodeGit.Cred);
21+
});
22+
23+
it("can create credentials using plaintext", function() {
24+
var plaintextCreds
25+
= NodeGit.Cred.userpassPlaintextNew("username", "password");
26+
27+
assert(plaintextCreds instanceof NodeGit.Cred);
28+
});
29+
});

0 commit comments

Comments
 (0)