Skip to content

Commit 9d16d66

Browse files
committedNov 1, 2015
Support for basic auth
1 parent 7631e9e commit 9d16d66

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
 

‎test/index.coffee

+21
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,27 @@ describe 'Connecting', ->
8383
done err, val
8484

8585

86+
describe 'Basic auth', ->
87+
88+
it 'should support basic auth', (done) ->
89+
auth =
90+
user: "username"
91+
pass: "password"
92+
etcd = new Etcd "localhost:4001", { auth: auth }
93+
94+
m = nock("http://localhost:4001")
95+
.get("/v2/keys/key")
96+
.basicAuth(
97+
user: "username",
98+
pass: "password"
99+
)
100+
.reply(200)
101+
102+
etcd.get 'key', (err, val) ->
103+
m.isDone().should.be.true
104+
done err, val
105+
106+
86107
describe 'Basic functions', ->
87108

88109
etcd = new Etcd

0 commit comments

Comments
 (0)
Please sign in to comment.