6530ce27fe
End statements with semicolons, to be consistent with the surrounding code. Added a new unit test to ensure environment variables are honored when parsing a connection string. Added a TODO to cleanup a test that emits messages using console.log(). Correct a query's syntax. Looks like a good thing to do even though the syntax doesn't matter in mocked out tests. Removed a test that tests for SELECT tags; AFAIK, SELECT commands don't emit a tag.
22 lines
759 B
JavaScript
22 lines
759 B
JavaScript
require(__dirname + '/test-helper');
|
|
|
|
test('md5 authentication', function() {
|
|
var client = createClient();
|
|
client.password = "!";
|
|
var salt = Buffer([1, 2, 3, 4]);
|
|
client.connection.emit('authenticationMD5Password', {salt: salt});
|
|
|
|
test('responds', function() {
|
|
assert.lengthIs(client.connection.stream.packets, 1);
|
|
test('should have correct encrypted data', function() {
|
|
var encrypted = Client.md5(client.password + client.user);
|
|
encrypted = Client.md5(encrypted + salt.toString('binary'));
|
|
var password = "md5" + encrypted
|
|
//how do we want to test this?
|
|
assert.equalBuffers(client.connection.stream.packets[0], new BufferList()
|
|
.addCString(password).join(true,'p'));
|
|
});
|
|
});
|
|
|
|
});
|