node-postgres/test/unit/client/cleartext-password-tests.js

22 lines
612 B
JavaScript
Raw Normal View History

require(__dirname+'/test-helper');
/*
* TODO: Add _some_ comments to explain what it is we're testing, and how the
* code-being-tested works behind the scenes.
*/
test('cleartext password authentication', function(){
var client = createClient();
client.password = "!";
2010-10-25 11:52:12 +08:00
client.connection.stream.packets = [];
client.connection.emit('authenticationCleartextPassword');
test('responds with password', function() {
2010-10-25 11:52:12 +08:00
var packets = client.connection.stream.packets;
assert.lengthIs(packets, 1);
2010-10-25 11:52:12 +08:00
var packet = packets[0];
assert.equalBuffers(packet, [0x70, 0, 0, 0, 6, 33, 0]);
});
});