-
Notifications
You must be signed in to change notification settings - Fork 369
Expand file tree
/
Copy pathrunner.js
More file actions
99 lines (79 loc) · 2.03 KB
/
runner.js
File metadata and controls
99 lines (79 loc) · 2.03 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
var Acl = require('../')
, tests = require('./tests')
describe('MongoDB - Default', function () {
before(function (done) {
var self = this
, mongodb = require('mongodb')
mongodb.connect('mongodb://localhost:27017/acltest',function(error, db) {
db.dropDatabase(function () {
self.backend = new Acl.mongodbBackend(db, "acl")
done()
})
})
})
run()
});
describe('MongoDB - useSingle', function () {
before(function (done) {
var self = this
, mongodb = require('mongodb')
mongodb.connect('mongodb://localhost:27017/acltest',function(error, db) {
db.dropDatabase(function () {
self.backend = new Acl.mongodbBackend(db, "acl", true)
done()
})
})
})
run()
});
// Attention: keyspace and columnfamily must exist beforehand
describe('Cassandra', function () {
before(function (done) {
var self = this
, cassandra = require('cassandra-driver');
client = new cassandra.Client({contactPoints: ['127.0.0.1']});
client.connect(function(err) {
if (err) return done(err);
client.execute("TRUNCATE acltest.acl", [], function(err) {
if (err) return done(err);
self.backend = new Acl.cassandraBackend(client, "acltest", "acl");
done()
});
});
});
run()
});
describe('Redis', function () {
before(function (done) {
var self = this
, options = {
host: '127.0.0.1',
port: 6379,
password: null
}
, Redis = require('redis')
var redis = Redis.createClient(options.port, options.host, {no_ready_check: true} )
function start(){
self.backend = new Acl.redisBackend(redis)
done()
}
if (options.password) {
redis.auth(options.password, start)
} else {
start()
}
})
run()
})
describe('Memory', function () {
before(function () {
var self = this
self.backend = new Acl.memoryBackend()
})
run()
})
function run() {
Object.keys(tests).forEach(function (test) {
tests[test]()
})
}