|
@@ -37,37 +37,38 @@ describe('basic', (context) => {
|
37
|
37
|
cleanup(storage, next)
|
38
|
38
|
})
|
39
|
39
|
|
40
|
|
- context('Group stores encryption key', (assert, next) => {
|
41
|
|
- const config = Config(storage)
|
42
|
|
- const address = crypto.address()
|
43
|
|
- const encryptionKey = crypto.encryptionKey()
|
44
|
|
- const group = Group(storage, address, { config, encryptionKey })
|
45
|
|
- assert.ok(group, 'group loaded')
|
46
|
|
- const encryptionKeyPath = path.join(config.root, 'groups', address.toString('hex'), 'encryption_key')
|
47
|
|
- assert.equal(
|
48
|
|
- fs.readFileSync(encryptionKeyPath).toString('hex'),
|
49
|
|
- encryptionKey.toString('hex'),
|
50
|
|
- 'encryption key stored correctly'
|
51
|
|
- )
|
52
|
|
- cleanup(storage, next)
|
53
|
|
- })
|
|
40
|
+ // context('Group stores encryption key', (assert, next) => {
|
|
41
|
+ // const config = Config(storage)
|
|
42
|
+ // const address = crypto.address()
|
|
43
|
+ // const encryptionKey = crypto.encryptionKey()
|
|
44
|
+ // const group = Group(storage, address, { config, encryptionKey })
|
|
45
|
+ // assert.ok(group, 'group loaded')
|
|
46
|
+ // const encryptionKeyPath = path.join(config.root, 'groups', address.toString('hex'), 'encryption_key')
|
|
47
|
+ // assert.equal(
|
|
48
|
+ // fs.readFileSync(encryptionKeyPath).toString('hex'),
|
|
49
|
+ // encryptionKey.toString('hex'),
|
|
50
|
+ // 'encryption key stored correctly'
|
|
51
|
+ // )
|
|
52
|
+ // cleanup(storage, next)
|
|
53
|
+ // })
|
|
54
|
+ //
|
|
55
|
+ // context('Group loads encryption key', (assert, next) => {
|
|
56
|
+ // const config = Config(storage)
|
|
57
|
+ // const address = crypto.address()
|
|
58
|
+ // const encryptionKey = crypto.encryptionKey()
|
|
59
|
+ // const encryptionKeyPath = path.join(config.root, 'groups', address.toString('hex'), 'encryption_key')
|
|
60
|
+ // mkdirp.sync(path.dirname(encryptionKeyPath))
|
|
61
|
+ // fs.writeFileSync(encryptionKeyPath, encryptionKey, { mode: fs.constants.S_IRUSR })
|
|
62
|
+ // const group = Group(storage, address, { config })
|
|
63
|
+ // assert.ok(group, 'group loaded')
|
|
64
|
+ // assert.equal(
|
|
65
|
+ // group.encryptionKey.toString('hex'),
|
|
66
|
+ // encryptionKey.toString('hex'),
|
|
67
|
+ // 'encryption key retrieved correctly'
|
|
68
|
+ // )
|
|
69
|
+ // cleanup(storage, next)
|
|
70
|
+ // })
|
54
|
71
|
|
55
|
|
- context('Group loads encryption key', (assert, next) => {
|
56
|
|
- const config = Config(storage)
|
57
|
|
- const address = crypto.address()
|
58
|
|
- const encryptionKey = crypto.encryptionKey()
|
59
|
|
- const encryptionKeyPath = path.join(config.root, 'groups', address.toString('hex'), 'encryption_key')
|
60
|
|
- mkdirp.sync(path.dirname(encryptionKeyPath))
|
61
|
|
- fs.writeFileSync(encryptionKeyPath, encryptionKey, { mode: fs.constants.S_IRUSR })
|
62
|
|
- const group = Group(storage, address, { config })
|
63
|
|
- assert.ok(group, 'group loaded')
|
64
|
|
- assert.equal(
|
65
|
|
- group.encryptionKey.toString('hex'),
|
66
|
|
- encryptionKey.toString('hex'),
|
67
|
|
- 'encryption key retrieved correctly'
|
68
|
|
- )
|
69
|
|
- cleanup(storage, next)
|
70
|
|
- })
|
71
|
72
|
context('returns a name', (assert, next) => {
|
72
|
73
|
var config = Config(storage)
|
73
|
74
|
var address = crypto.address()
|
|
@@ -169,6 +170,26 @@ describe('basic', (context) => {
|
169
|
170
|
})
|
170
|
171
|
})
|
171
|
172
|
})
|
|
173
|
+
|
|
174
|
+ context('ls drive', (assert, next) => {
|
|
175
|
+ const config = Config(storage)
|
|
176
|
+ const address = crypto.address()
|
|
177
|
+ const group = Group(storage, address, { config })
|
|
178
|
+ assert.ok(group, 'group loaded')
|
|
179
|
+ group.ready(() => {
|
|
180
|
+ group.drive.writeFile('/hello.txt', 'world', (err) => {
|
|
181
|
+ assert.error(err, 'no error on writeFile')
|
|
182
|
+ group.ls().then((dirObj) => {
|
|
183
|
+ assert.equal(Object.keys(dirObj)[0], 'hello.txt', 'lists file')
|
|
184
|
+ assert.true(dirObj['hello.txt'].mtime > 10000, 'file has a timestamp')
|
|
185
|
+ cleanup(storage, next)
|
|
186
|
+ }, (err) => {
|
|
187
|
+ assert.error(err, 'no error')
|
|
188
|
+ cleanup(storage, next)
|
|
189
|
+ })
|
|
190
|
+ })
|
|
191
|
+ })
|
|
192
|
+ })
|
172
|
193
|
})
|
173
|
194
|
|
174
|
195
|
describe('connection', (context) => {
|
|
@@ -269,6 +290,7 @@ describe('connection', (context) => {
|
269
|
290
|
}
|
270
|
291
|
})
|
271
|
292
|
})
|
|
293
|
+
|
272
|
294
|
})
|
273
|
295
|
|
274
|
296
|
describe('replication', (context) => {
|