Skip to content

Commit c8c1d36

Browse files
author
nicola
committed
flag to options, now accounts should all be in a folder
1 parent 28b4cdf commit c8c1d36

4 files changed

Lines changed: 28 additions & 6 deletions

File tree

‎bin/ldnode.js‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,9 @@ var argv = require('nomnom')
5050
flag: true
5151
})
5252
.option('idp', {
53-
help: 'Allow registration of WebIDs',
53+
help: 'Allow registration of WebIDs (e.g. \'accounts/\')',
5454
abbr: 'idp',
55-
full: 'identity-provider',
56-
flag: true
55+
full: 'identity-provider'
5756
})
5857
.option('secret', {
5958
help: 'HTTP Session secret key (e.g. "your secret phrase")',

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"redis": "^0.12.1",
4848
"request": "^2.58.0",
4949
"response-time": "^2.3.1",
50+
"rimraf": "^2.5.0",
5051
"solid-acl": "^1.0.1",
5152
"solid-ws": "^0.2.0",
5253
"string": "^3.3.0",

‎test/identity-provider.js‎

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('Identity Provider', function () {
2525
key: __dirname + '/keys/key.pem',
2626
cert: __dirname + '/keys/cert.pem',
2727
webid: true,
28-
idp: true,
28+
idp: __dirname + '/resources/accounts/',
2929
host: 'localhost:3457'
3030
})
3131

@@ -66,7 +66,28 @@ describe('Identity Provider', function () {
6666
it('should return create WebID if only username is given', function (done) {
6767
server.post('/accounts')
6868
.send('username=nicola')
69-
.expect(201, done)
69+
.expect(201)
70+
.end(function (err) {
71+
rm('accounts/nicola.localhost:3457')
72+
done(err)
73+
})
74+
})
75+
it('should not create an account if the account already exists', function (done) {
76+
server.post('/accounts')
77+
.send('username=nicola')
78+
.expect(201)
79+
.end(function (err) {
80+
if (err) {
81+
return done(err)
82+
}
83+
server.post('/accounts')
84+
.send('username=nicola')
85+
.expect(406)
86+
.end(function (err) {
87+
rm('accounts/nicola.localhost:3457')
88+
done(err)
89+
})
90+
})
7091
})
7192
})
7293
})

‎test/test-utils.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
var fs = require('fs');
22
var fsExtra = require('fs-extra');
3+
var rimraf = require('rimraf')
34

45
exports.rm = function (file) {
5-
return fs.unlinkSync(__dirname + '/resources/' + file);
6+
return rimraf.sync('/resources/' + file);
67
};
78

89
exports.write = function (text, file) {

0 commit comments

Comments
 (0)