test-old-password.js 789 B

123456789101112131415161718192021222324252627282930313233343536
  1. var common = require('../../common');
  2. var connection = common.createConnection({
  3. port : common.fakeServerPort,
  4. password : 'oldpw',
  5. insecureAuth : true,
  6. });
  7. var assert = require('assert');
  8. var server = common.createFakeServer();
  9. var connected;
  10. server.listen(common.fakeServerPort, function(err) {
  11. if (err) throw err;
  12. connection.connect(function(err, result) {
  13. if (err) throw err;
  14. connected = result;
  15. connection.destroy();
  16. server.destroy();
  17. });
  18. });
  19. server.on('connection', function(incomingConnection) {
  20. incomingConnection.handshake({
  21. user : connection.config.user,
  22. password : connection.config.password,
  23. oldPassword : true,
  24. });
  25. });
  26. process.on('exit', function() {
  27. assert.equal(connected.fieldCount, 0);
  28. });