Skip to content

Commit a745c95

Browse files
committed
Fixed the way to get the lock-token from a LOCK response in the tests
1 parent c2c6a98 commit a745c95

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

test/tests/lock.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ module.exports = (test, options, index) => test('lock', (isValid, server) =>
103103
},
104104
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>'
105105
}, (e, res, body) => _(e, () => {
106-
const lock = body.substr(body.indexOf('<D:locktoken><D:href>') + '<D:locktoken><D:href>'.length, 'urn:uuid:24fa520c-520c-14fa-00d6-0000d546f655'.length);
106+
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>')));
107107

108108
request({
109109
url: url + '/test4.txt',

test/tests/unlock.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ module.exports = (test, options, index) => test('unlock', (isValid, server) =>
3636
return;
3737
}
3838

39-
const lock = body.substr(body.indexOf('<D:locktoken><D:href>') + '<D:locktoken><D:href>'.length, 'urn:uuid:24fa520c-520c-14fa-00d6-0000d546f655'.length);
40-
39+
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>')));
40+
console.log(lock);
4141
request({
4242
url: url + '/test.txt',
4343
method: 'UNLOCK',
@@ -89,7 +89,7 @@ module.exports = (test, options, index) => test('unlock', (isValid, server) =>
8989
},
9090
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>'
9191
}, (e, res, body) => _(e, () => {
92-
const lock = body.substr(body.indexOf('<D:locktoken><D:href>') + '<D:locktoken><D:href>'.length, 'urn:uuid:24fa520c-520c-14fa-00d6-0000d546f655'.length);
92+
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>')));
9393

9494
request({
9595
url: url + '/test3.txt',
@@ -136,7 +136,7 @@ module.exports = (test, options, index) => test('unlock', (isValid, server) =>
136136
},
137137
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>'
138138
}, (e, res, body) => _(e, () => {
139-
const lock = body.substr(body.indexOf('<D:locktoken><D:href>') + '<D:locktoken><D:href>'.length, 'urn:uuid:24fa520c-520c-14fa-00d6-0000d546f655'.length);
139+
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>')));
140140

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

0 commit comments

Comments
 (0)