Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
jio
Commits
49a12950
Commit
49a12950
authored
Jan 24, 2014
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
davstorage test added for allDocs+include_docs
parent
54d630e4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
140 additions
and
3 deletions
+140
-3
src/jio.storage/davstorage.js
src/jio.storage/davstorage.js
+2
-2
test/jio.storage/davstorage.tests.js
test/jio.storage/davstorage.tests.js
+138
-1
No files found.
src/jio.storage/davstorage.js
View file @
49a12950
...
...
@@ -879,9 +879,9 @@
return
;
}
e
.
target
.
response
.
data
.
rows
.
forEach
(
function
(
row
)
{
e
.
target
.
response
.
rows
.
forEach
(
function
(
row
)
{
requests
[
requests
.
length
]
=
that
.
_get
({
"
_id
"
:
row
.
id
}).
done
(
function
(
e
)
{
then
(
function
(
e
)
{
row
.
doc
=
e
.
target
.
response
;
});
});
...
...
test/jio.storage/davstorage.tests.js
View file @
49a12950
...
...
@@ -62,7 +62,7 @@
* X-Requested-With, X-HTTP-Method-Override, Accept, Authorization,
* Depth"
*/
test
(
"
Scenario
"
,
3
2
,
function
()
{
test
(
"
Scenario
"
,
3
3
,
function
()
{
var
server
,
responses
=
[],
shared
=
{},
jio
=
jIO
.
createJIO
(
spec
,
{
"
workspace
"
:
{},
...
...
@@ -465,6 +465,141 @@
},
"
List 2 documents
"
);
}
function
listDocumentsWithMetadata
()
{
responses
.
push
([
207
,
{
"
Content-Type
"
:
"
text/xml
"
},
'
<?xml version="1.0" encoding="utf-8"?>
'
+
'
<D:multistatus xmlns:D="DAV:">
'
+
'
<D:response xmlns:lp2="http://apache.
'
+
'
org/dav/props/" xmlns:lp1="DAV:">
'
+
'
<D:href>/uploads/</D:href>
'
+
'
<D:propstat>
'
+
'
<D:prop>
'
+
'
<lp1:resourcetype><D:collection/></lp1:resourcetype>
'
+
'
<lp1:creationdate>2013-09-19T11:54:43Z</lp1:creationdate>
'
+
'
<lp1:getlastmodified>Thu, 19 Sep 2013 11:54:43 GMT
'
+
'
</lp1:getlastmodified>
'
+
'
<lp1:getetag>"240be-1000-4e6bb383e5fbb"</lp1:getetag>
'
+
'
<D:supportedlock>
'
+
'
<D:lockentry>
'
+
'
<D:lockscope><D:exclusive/></D:lockscope>
'
+
'
<D:locktype><D:write/></D:locktype>
'
+
'
</D:lockentry>
'
+
'
<D:lockentry>
'
+
'
<D:lockscope><D:shared/></D:lockscope>
'
+
'
<D:locktype><D:write/></D:locktype>
'
+
'
</D:lockentry>
'
+
'
</D:supportedlock>
'
+
'
<D:lockdiscovery/>
'
+
'
<D:getcontenttype>httpd/unix-directory</D:getcontenttype>
'
+
'
</D:prop>
'
+
'
<D:status>HTTP/1.1 200 OK</D:status>
'
+
'
</D:propstat>
'
+
'
</D:response>
'
+
'
<D:response xmlns:lp2="http://apache.org/dav/props/"
'
+
'
xmlns:lp1="DAV:">
'
+
'
<D:href>/uploads/
'
+
shared
.
created_document_id
+
'
</D:href>
'
+
'
<D:propstat>
'
+
'
<D:prop>
'
+
'
<lp1:resourcetype/>
'
+
'
<lp1:creationdate>2013-09-19T11:54:43Z</lp1:creationdate>
'
+
'
<lp1:getcontentlength>66</lp1:getcontentlength>
'
+
'
<lp1:getlastmodified>Thu, 19 Sep 2013 11:54:43 GMT
'
+
'
</lp1:getlastmodified>
'
+
'
<lp1:getetag>"20529-42-4e6bb383d0d30"</lp1:getetag>
'
+
'
<lp2:executable>F</lp2:executable>
'
+
'
<D:supportedlock>
'
+
'
<D:lockentry>
'
+
'
<D:lockscope><D:exclusive/></D:lockscope>
'
+
'
<D:locktype><D:write/></D:locktype>
'
+
'
</D:lockentry>
'
+
'
<D:lockentry>
'
+
'
<D:lockscope><D:shared/></D:lockscope>
'
+
'
<D:locktype><D:write/></D:locktype>
'
+
'
</D:lockentry>
'
+
'
</D:supportedlock>
'
+
'
<D:lockdiscovery/>
'
+
'
</D:prop>
'
+
'
<D:status>HTTP/1.1 200 OK</D:status>
'
+
'
</D:propstat>
'
+
'
</D:response>
'
+
'
<D:response xmlns:lp2="http://apache.org/dav/props/"
'
+
'
xmlns:lp1="DAV:">
'
+
'
<D:href>/uploads/b</D:href>
'
+
'
<D:propstat>
'
+
'
<D:prop>
'
+
'
<lp1:resourcetype/>
'
+
'
<lp1:creationdate>2013-09-19T11:54:43Z</lp1:creationdate>
'
+
'
<lp1:getcontentlength>25</lp1:getcontentlength>
'
+
'
<lp1:getlastmodified>Thu, 19 Sep 2013 11:54:43 GMT
'
+
'
</lp1:getlastmodified>
'
+
'
<lp1:getetag>"20da3-19-4e6bb383e5fbb"</lp1:getetag>
'
+
'
<lp2:executable>F</lp2:executable>
'
+
'
<D:supportedlock>
'
+
'
<D:lockentry>
'
+
'
<D:lockscope><D:exclusive/></D:lockscope>
'
+
'
<D:locktype><D:write/></D:locktype>
'
+
'
</D:lockentry>
'
+
'
<D:lockentry>
'
+
'
<D:lockscope><D:shared/></D:lockscope>
'
+
'
<D:locktype><D:write/></D:locktype>
'
+
'
</D:lockentry>
'
+
'
</D:supportedlock>
'
+
'
<D:lockdiscovery/>
'
+
'
</D:prop>
'
+
'
<D:status>HTTP/1.1 200 OK</D:status>
'
+
'
</D:propstat>
'
+
'
</D:response>
'
+
'
</D:multistatus>
'
]);
// PROPFIND
responses
.
push
([
200
,
{
"
Content-Type
"
:
"
application/octet-stream
"
},
JSON
.
stringify
({
"
_id
"
:
shared
.
created_document_id
,
"
title
"
:
"
Unique ID
"
})]);
// GET
responses
.
push
([
200
,
{
"
Content-Type
"
:
"
application/octet-stream
"
},
JSON
.
stringify
({
"
_id
"
:
"
b
"
,
"
title
"
:
"
Bee
"
})]);
// GET
return
jio
.
allDocs
({
"
include_docs
"
:
true
});
}
function
list2DocumentsWithMetadataTest
(
answer
)
{
if
(
answer
&&
answer
.
data
&&
Array
.
isArray
(
answer
.
data
.
rows
))
{
answer
.
data
.
rows
.
sort
(
function
(
a
)
{
return
a
.
id
===
"
b
"
?
1
:
0
;
});
}
deepEqual
(
answer
,
{
"
data
"
:
{
"
total_rows
"
:
2
,
"
rows
"
:
[{
"
id
"
:
shared
.
created_document_id
,
"
value
"
:
{},
"
doc
"
:
{
"
_id
"
:
shared
.
created_document_id
,
"
title
"
:
"
Unique ID
"
}
},
{
"
id
"
:
"
b
"
,
"
value
"
:
{},
"
doc
"
:
{
"
_id
"
:
"
b
"
,
"
title
"
:
"
Bee
"
}
}]
},
"
method
"
:
"
allDocs
"
,
"
result
"
:
"
success
"
,
"
status
"
:
200
,
"
statusText
"
:
"
Ok
"
},
"
List 2 documents with their metadata
"
);
}
function
removeCreatedDocument
()
{
responses
.
push
([
200
,
{
"
Content-Type
"
:
"
application/octet-stream
"
...
...
@@ -1161,6 +1296,8 @@
then
(
checkStorage
).
then
(
checkStorageTest
).
// allD 200 2 documents
then
(
listDocuments
).
then
(
list2DocumentsTest
).
// allD+include_docs 200 2 documents
then
(
listDocumentsWithMetadata
).
then
(
list2DocumentsWithMetadataTest
).
// remove a 204
then
(
removeCreatedDocument
).
then
(
removeCreatedDocumentTest
).
// remove b 204
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment