-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathsasl-scram-tests.js
41 lines (34 loc) · 1.03 KB
/
sasl-scram-tests.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
'use strict'
var helper = require(__dirname + '/../test-helper')
var pg = helper.pg
var suite = new helper.Suite()
/*
SQL to create test role:
set password_encryption = 'scram-sha-256';
create role npgtest login password 'test';
pg_hba:
host all npgtest ::1/128 scram-sha-256
host all npgtest 0.0.0.0/0 scram-sha-256
*/
/*
suite.test('can connect using sasl/scram', function () {
var connectionString = 'pg://npgtest:test@localhost/postgres'
const pool = new pg.Pool({ connectionString: connectionString })
pool.connect(
assert.calls(function (err, client, done) {
assert.ifError(err, 'should have connected')
done()
})
)
})
suite.test('sasl/scram fails when password is wrong', function () {
var connectionString = 'pg://npgtest:bad@localhost/postgres'
const pool = new pg.Pool({ connectionString: connectionString })
pool.connect(
assert.calls(function (err, client, done) {
assert.ok(err, 'should have a connection error')
done()
})
)
})
*/