Skip to content

Commit 12ee28b

Browse files
committed
tests: add explicit unit test for no password auth
1 parent bc9cd35 commit 12ee28b

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
var assert = require('assert');
2+
var common = require('../../common');
3+
var connection = common.createConnection({
4+
port : common.fakeServerPort,
5+
password : null,
6+
user : 'root'
7+
});
8+
9+
var server = common.createFakeServer();
10+
11+
server.listen(common.fakeServerPort, function (err) {
12+
assert.ifError(err);
13+
14+
connection.connect(function (err) {
15+
assert.ifError(err);
16+
connection.destroy();
17+
server.destroy();
18+
});
19+
});
20+
21+
server.on('connection', function(incomingConnection) {
22+
incomingConnection.on('clientAuthentication', function (packet) {
23+
if (packet.scrambleBuff.length === 0) {
24+
this.ok();
25+
} else {
26+
this.deny();
27+
}
28+
});
29+
30+
incomingConnection.handshake();
31+
});

0 commit comments

Comments
 (0)