Skip to content

Commit

Permalink
Fixed the way to get the lock-token from a LOCK response in the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienCastex committed Jun 7, 2017
1 parent c2c6a98 commit a745c95
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/tests/lock.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ module.exports = (test, options, index) => test('lock', (isValid, server) =>
},
body: '<?xml version="1.0" encoding="utf-8" ?><D:lockinfo xmlns:D="DAV:"><D:lockscope><D:exclusive/></D:lockscope><D:locktype><D:write/></D:locktype><D:owner><D:href>'+url+'/user</D:href></D:owner></D:lockinfo>'
}, (e, res, body) => _(e, () => {
const lock = body.substr(body.indexOf('<D:locktoken><D:href>') + '<D:locktoken><D:href>'.length, 'urn:uuid:24fa520c-520c-14fa-00d6-0000d546f655'.length);
const lock = body.substring(body.indexOf('<D:locktoken><D:href>') + '<D:locktoken><D:href>'.length, body.indexOf('</D:href>', body.indexOf('<D:locktoken><D:href>')));

request({
url: url + '/test4.txt',
Expand Down
8 changes: 4 additions & 4 deletions test/tests/unlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ module.exports = (test, options, index) => test('unlock', (isValid, server) =>
return;
}

const lock = body.substr(body.indexOf('<D:locktoken><D:href>') + '<D:locktoken><D:href>'.length, 'urn:uuid:24fa520c-520c-14fa-00d6-0000d546f655'.length);

const lock = body.substring(body.indexOf('<D:locktoken><D:href>') + '<D:locktoken><D:href>'.length, body.indexOf('</D:href>', body.indexOf('<D:locktoken><D:href>')));
console.log(lock);
request({
url: url + '/test.txt',
method: 'UNLOCK',
Expand Down Expand Up @@ -89,7 +89,7 @@ module.exports = (test, options, index) => test('unlock', (isValid, server) =>
},
body: '<?xml version="1.0" encoding="utf-8" ?><D:lockinfo xmlns:D="DAV:"><D:lockscope><D:exclusive/></D:lockscope><D:locktype><D:write/></D:locktype><D:owner><D:href>'+url+'/user</D:href></D:owner></D:lockinfo>'
}, (e, res, body) => _(e, () => {
const lock = body.substr(body.indexOf('<D:locktoken><D:href>') + '<D:locktoken><D:href>'.length, 'urn:uuid:24fa520c-520c-14fa-00d6-0000d546f655'.length);
const lock = body.substring(body.indexOf('<D:locktoken><D:href>') + '<D:locktoken><D:href>'.length, body.indexOf('</D:href>', body.indexOf('<D:locktoken><D:href>')));

request({
url: url + '/test3.txt',
Expand Down Expand Up @@ -136,7 +136,7 @@ module.exports = (test, options, index) => test('unlock', (isValid, server) =>
},
body: '<?xml version="1.0" encoding="utf-8" ?><D:lockinfo xmlns:D="DAV:"><D:lockscope><D:exclusive/></D:lockscope><D:locktype><D:write/></D:locktype><D:owner><D:href>'+url+'/user</D:href></D:owner></D:lockinfo>'
}, (e, res, body) => _(e, () => {
const lock = body.substr(body.indexOf('<D:locktoken><D:href>') + '<D:locktoken><D:href>'.length, 'urn:uuid:24fa520c-520c-14fa-00d6-0000d546f655'.length);
const lock = body.substring(body.indexOf('<D:locktoken><D:href>') + '<D:locktoken><D:href>'.length, body.indexOf('</D:href>', body.indexOf('<D:locktoken><D:href>')));

wfsOwner.writeFile('/testFolder/test5.txt', 'Content!', (e) => _(e, () => {
wfsNotOwner.writeFile('/testFolder/test5.txt', 'Content!', (e) => {
Expand Down

0 comments on commit a745c95

Please sign in to comment.