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
Douglas
jio
Commits
d95ddd37
Commit
d95ddd37
authored
Jul 18, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make gid tests more explicit by adding comments
parent
ca6e3171
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
107 additions
and
64 deletions
+107
-64
test/jiotests.js
test/jiotests.js
+107
-64
No files found.
test/jiotests.js
View file @
d95ddd37
...
...
@@ -7974,6 +7974,7 @@ test("Post", function () {
"
application_name
"
:
"
gid storage post test
"
};
// local jio is going to help us to prepare localstorage for gid tests
o
.
local_jio
=
JIO
.
newJio
(
o
.
localstorage_spec
);
o
.
jio
=
JIO
.
newJio
({
...
...
@@ -7981,37 +7982,42 @@ test("Post", function () {
"
sub_storage
"
:
o
.
localstorage_spec
,
"
constraints
"
:
{
"
default
"
:
{
"
identifie
r
"
:
"
list
"
"
creato
r
"
:
"
list
"
}
}
});
o
.
local_jio
.
put
({
"
_id
"
:
"
blue
"
,
"
identifier
"
:
"
a
"
});
o
.
local_jio
.
put
({
"
_id
"
:
"
green
"
,
"
identifier
"
:
[
"
ac
"
,
"
b
"
]});
// preparing localstorage with documents
o
.
local_jio
.
put
({
"
_id
"
:
"
blue
"
,
"
creator
"
:
"
a
"
,
"
title
"
:
"
earth
"
});
o
.
local_jio
.
put
({
"
_id
"
:
"
green
"
,
"
creator
"
:
[
"
ac
"
,
"
b
"
],
"
title
"
:
"
wind
"
});
o
.
clock
.
tick
(
2000
);
o
.
local_jio
.
stop
();
// Fail to post a document because metadata doesn't respect constraints
// XXX check reason
o
.
spy
(
o
,
'
status
'
,
400
,
'
Post document without respecting constraints
'
+
'
-> bad request
'
);
o
.
jio
.
post
({},
o
.
f
);
o
.
tick
(
o
);
// Fail to post a document but a document already exists
o
.
spy
(
o
,
'
status
'
,
409
,
'
Post existent document -> conflict
'
);
o
.
jio
.
post
({
"
identifier
"
:
"
a
"
},
o
.
f
);
o
.
jio
.
post
({
"
creator
"
:
"
a
"
,
"
title
"
:
"
water
"
},
o
.
f
);
o
.
tick
(
o
);
// Succeed to post because no document with the same gid has been found
o
.
spy
(
o
,
'
value
'
,
{
"
id
"
:
"
{
\"
identifie
r
\"
:[
\"
a%
\"
]}
"
,
"
id
"
:
"
{
\"
creato
r
\"
:[
\"
a%
\"
]}
"
,
"
ok
"
:
true
},
'
Post respecting constraints
'
);
o
.
jio
.
post
({
"
identifier
"
:
"
a%
"
},
o
.
f
);
o
.
jio
.
post
({
"
creator
"
:
"
a%
"
,
"
title
"
:
"
fire
"
},
o
.
f
);
o
.
tick
(
o
);
// Fail to post because this document has been uploaded right before
o
.
spy
(
o
,
'
status
'
,
409
,
'
Post same document respecting constraints
'
+
'
-> conflicts
'
);
o
.
jio
.
post
({
"
identifier
"
:
"
a%
"
},
o
.
f
);
o
.
jio
.
post
({
"
creator
"
:
"
a%
"
,
"
title
"
:
"
space
"
},
o
.
f
);
o
.
tick
(
o
);
o
.
jio
.
stop
();
...
...
@@ -8026,6 +8032,7 @@ test("Get", function () {
"
application_name
"
:
"
gid storage get test
"
};
// local jio is going to help us to prepare localstorage for gid tests
o
.
local_jio
=
JIO
.
newJio
(
o
.
localstorage_spec
);
o
.
jio
=
JIO
.
newJio
({
...
...
@@ -8033,31 +8040,36 @@ test("Get", function () {
"
sub_storage
"
:
o
.
localstorage_spec
,
"
constraints
"
:
{
"
default
"
:
{
"
identifie
r
"
:
"
list
"
"
creato
r
"
:
"
list
"
}
}
});
o
.
local_jio
.
put
({
"
_id
"
:
"
blue
"
,
"
identifier
"
:
"
a
"
});
o
.
local_jio
.
put
({
"
_id
"
:
"
red
"
,
"
identifier
"
:
[
"
ac
"
,
"
b
"
]});
// preparing localstorage with documents
o
.
local_jio
.
put
({
"
_id
"
:
"
blue
"
,
"
creator
"
:
"
a
"
,
"
title
"
:
"
earth
"
});
o
.
local_jio
.
put
({
"
_id
"
:
"
red
"
,
"
creator
"
:
[
"
ac
"
,
"
b
"
],
"
title
"
:
"
wind
"
});
o
.
clock
.
tick
(
2000
);
o
.
local_jio
.
stop
();
// Fail to get document because _id doesn't respect constraints
o
.
spy
(
o
,
'
status
'
,
400
,
'
Get document without respecting constraints
'
+
'
-> bad request
'
);
o
.
jio
.
get
({
"
_id
"
:
"
a
"
},
o
.
f
);
o
.
tick
(
o
);
// Fail to get because no document with the same gid has been found
o
.
spy
(
o
,
'
status
'
,
404
,
'
Get inexistent document
'
);
o
.
jio
.
get
({
"
_id
"
:
"
{
\"
identifie
r
\"
:[
\"
c
\"
]}
"
},
o
.
f
);
o
.
jio
.
get
({
"
_id
"
:
"
{
\"
creato
r
\"
:[
\"
c
\"
]}
"
},
o
.
f
);
o
.
tick
(
o
);
// Succeed to get, gid is good, document found
o
.
spy
(
o
,
'
value
'
,
{
"
_id
"
:
"
{
\"
identifier
\"
:[
\"
b
\"
]}
"
,
"
identifier
"
:
[
"
ac
"
,
"
b
"
]
"
_id
"
:
"
{
\"
creator
\"
:[
\"
b
\"
]}
"
,
"
creator
"
:
[
"
ac
"
,
"
b
"
],
"
title
"
:
"
wind
"
},
'
Get document
'
);
o
.
jio
.
get
({
"
_id
"
:
"
{
\"
identifie
r
\"
:[
\"
b
\"
]}
"
},
o
.
f
);
o
.
jio
.
get
({
"
_id
"
:
"
{
\"
creato
r
\"
:[
\"
b
\"
]}
"
},
o
.
f
);
o
.
tick
(
o
);
o
.
jio
.
stop
();
...
...
@@ -8072,6 +8084,7 @@ test("AllDocs", function () {
"
application_name
"
:
"
gid storage allDocs test
"
};
// local jio is going to help us to prepare localstorage for gid tests
o
.
local_jio
=
JIO
.
newJio
(
o
.
localstorage_spec
);
o
.
jio
=
JIO
.
newJio
({
...
...
@@ -8079,53 +8092,56 @@ test("AllDocs", function () {
"
sub_storage
"
:
o
.
localstorage_spec
,
"
constraints
"
:
{
"
default
"
:
{
"
identifie
r
"
:
"
list
"
"
creato
r
"
:
"
list
"
}
}
});
o
.
local_jio
.
put
({
"
_id
"
:
"
green
"
,
"
identifier
"
:
[
"
a
"
]})
o
.
local_jio
.
put
({
"
_id
"
:
"
red
"
,
"
identifier
"
:
[
"
a
"
,
"
b
"
]})
o
.
local_jio
.
put
({
"
_id
"
:
"
yellow
"
,
"
identifier
"
:
[
"
c
"
,
"
d
"
]})
o
.
local_jio
.
put
({
"
_id
"
:
"
purple
"
,
"
identifier
"
:
[
"
p
"
,
"
d
"
]})
o
.
local_jio
.
put
({
"
_id
"
:
"
blue
"
,
"
title
"
:
"
Hey
"
})
// preparing localstorage with documents
o
.
local_jio
.
put
({
"
_id
"
:
"
green
"
,
"
creator
"
:
[
"
a
"
],
"
title
"
:
"
earth
"
});
o
.
local_jio
.
put
({
"
_id
"
:
"
red
"
,
"
creator
"
:
[
"
a
"
,
"
b
"
],
"
title
"
:
"
water
"
});
o
.
local_jio
.
put
({
"
_id
"
:
"
yellow
"
,
"
creator
"
:
[
"
c
"
,
"
d
"
],
"
title
"
:
"
wind
"
});
o
.
local_jio
.
put
({
"
_id
"
:
"
purple
"
,
"
creator
"
:
[
"
s
"
,
"
d
"
],
"
title
"
:
"
fire
"
});
o
.
local_jio
.
put
({
"
_id
"
:
"
blue
"
,
"
title
"
:
"
space
"
})
o
.
clock
.
tick
(
3000
);
o
.
local_jio
.
stop
();
// Get all document and sort to make comparison easier
o
.
spy
(
o
,
'
value
'
,
{
"
rows
"
:
[{
"
id
"
:
"
{
\"
identifie
r
\"
:[
\"
a
\"
]}
"
,
"
id
"
:
"
{
\"
creato
r
\"
:[
\"
a
\"
]}
"
,
"
value
"
:
{}
},
{
"
id
"
:
"
{
\"
identifie
r
\"
:[
\"
a
\"
,
\"
b
\"
]}
"
,
"
id
"
:
"
{
\"
creato
r
\"
:[
\"
a
\"
,
\"
b
\"
]}
"
,
"
value
"
:
{}
},
{
"
id
"
:
"
{
\"
identifie
r
\"
:[
\"
c
\"
,
\"
d
\"
]}
"
,
"
id
"
:
"
{
\"
creato
r
\"
:[
\"
c
\"
,
\"
d
\"
]}
"
,
"
value
"
:
{}
},
{
"
id
"
:
"
{
\"
identifier
\"
:[
\"
p
\"
,
\"
d
\"
]}
"
,
"
id
"
:
"
{
\"
creator
\"
:[
\"
s
\"
,
\"
d
\"
]}
"
,
"
value
"
:
{}
}],
"
total_rows
"
:
4
},
'
Get all docs
'
);
o
.
jio
.
allDocs
({
"
sort_on
"
:
[[
"
identifie
r
"
,
"
ascending
"
]]
"
sort_on
"
:
[[
"
creato
r
"
,
"
ascending
"
]]
},
o
.
f
);
o
.
tick
(
o
);
// Get all document with complex queries
o
.
spy
(
o
,
'
value
'
,
{
"
rows
"
:
[{
"
id
"
:
"
{
\"
identifier
\"
:[
\"
a
\"
,
\"
b
\"
]}
"
,
"
id
"
:
"
{
\"
creator
\"
:[
\"
s
\"
,
\"
d
\"
]}
"
,
"
value
"
:
{}
}],
"
total_rows
"
:
1
},
'
Get all docs
'
);
o
.
jio
.
allDocs
({
"
query
"
:
'
identifier: "a
"
'
,
"
select
"
:
[
"
identifie
r
"
],
"
query
"
:
'
creator: "d
"
'
,
"
select
"
:
[
"
creato
r
"
],
"
limit
"
:
[
1
,
1
],
"
sort_on
"
:
[[
"
identifie
r
"
,
"
ascending
"
]]
"
sort_on
"
:
[[
"
creato
r
"
,
"
ascending
"
]]
},
o
.
f
);
o
.
tick
(
o
);
...
...
@@ -8141,6 +8157,7 @@ test("Put", function () {
"
application_name
"
:
"
gid storage put test
"
};
// local jio is going to help us to prepare localstorage for gid tests
o
.
local_jio
=
JIO
.
newJio
(
o
.
localstorage_spec
);
o
.
jio
=
JIO
.
newJio
({
...
...
@@ -8148,55 +8165,62 @@ test("Put", function () {
"
sub_storage
"
:
o
.
localstorage_spec
,
"
constraints
"
:
{
"
default
"
:
{
"
identifie
r
"
:
"
list
"
"
creato
r
"
:
"
list
"
}
}
});
o
.
local_jio
.
put
({
"
_id
"
:
"
blue
"
,
"
identifier
"
:
"
a
"
});
o
.
local_jio
.
put
({
"
_id
"
:
"
green
"
,
"
identifier
"
:
[
"
ac
"
,
"
b
"
]});
// preparing localstorage with documents
o
.
local_jio
.
put
({
"
_id
"
:
"
blue
"
,
"
creator
"
:
"
a
"
,
"
title
"
:
"
earth
"
});
o
.
local_jio
.
put
({
"
_id
"
:
"
green
"
,
"
creator
"
:
[
"
ac
"
,
"
b
"
],
"
title
"
:
"
wind
"
});
o
.
clock
.
tick
(
2000
);
// Fail to put document because id does not respect constraints
o
.
spy
(
o
,
'
status
'
,
400
,
'
Put document without respecting constraints
'
+
'
-> bad request
'
);
o
.
jio
.
put
({
"
_id
"
:
"
a
"
,
"
identifier
"
:
"
a
"
,
"
title
"
:
"
t
"
},
o
.
f
);
o
.
jio
.
put
({
"
_id
"
:
"
a
"
,
"
creator
"
:
"
a
"
,
"
title
"
:
"
fire
"
},
o
.
f
);
o
.
tick
(
o
);
// Fail to put because gid given != gid generated by the constraints
o
.
spy
(
o
,
'
status
'
,
400
,
'
Put document without respecting constraints
'
+
'
-> bad request
'
);
o
.
jio
.
put
({
"
_id
"
:
"
{
\"
identifie
r
\"
:[
\"
a
\"
]}
"
,
"
identifie
r
"
:
"
b
"
,
"
title
"
:
"
t
"
"
_id
"
:
"
{
\"
creato
r
\"
:[
\"
a
\"
]}
"
,
"
creato
r
"
:
"
b
"
,
"
title
"
:
"
water
"
},
o
.
f
);
o
.
tick
(
o
);
// Succeed to update a document with its gid
o
.
spy
(
o
,
'
value
'
,
{
"
ok
"
:
true
,
"
id
"
:
"
{
\"
identifie
r
\"
:[
\"
a
\"
]}
"
"
id
"
:
"
{
\"
creato
r
\"
:[
\"
a
\"
]}
"
},
'
Update document
'
);
o
.
jio
.
put
({
"
_id
"
:
"
{
\"
identifie
r
\"
:[
\"
a
\"
]}
"
,
"
identifie
r
"
:
"
a
"
,
"
title
"
:
"
t
"
"
_id
"
:
"
{
\"
creato
r
\"
:[
\"
a
\"
]}
"
,
"
creato
r
"
:
"
a
"
,
"
title
"
:
"
space
"
},
o
.
f
);
o
.
tick
(
o
);
// Succeed to create a document, the gid given is good
o
.
spy
(
o
,
'
value
'
,
{
"
ok
"
:
true
,
"
id
"
:
"
{
\"
identifie
r
\"
:[
\"
c
\"
]}
"
"
id
"
:
"
{
\"
creato
r
\"
:[
\"
c
\"
]}
"
},
'
Create document
'
);
o
.
jio
.
put
({
"
_id
"
:
"
{
\"
identifie
r
\"
:[
\"
c
\"
]}
"
,
"
identifie
r
"
:
"
c
"
,
"
title
"
:
"
i
"
"
_id
"
:
"
{
\"
creato
r
\"
:[
\"
c
\"
]}
"
,
"
creato
r
"
:
"
c
"
,
"
title
"
:
"
magma
"
},
o
.
f
);
o
.
tick
(
o
);
// Check if the local storage document is well updated to make sure the second
// put did not update the wrong document.
o
.
spy
(
o
,
'
value
'
,
{
"
_id
"
:
"
blue
"
,
"
identifie
r
"
:
"
a
"
,
"
title
"
:
"
t
"
"
creato
r
"
:
"
a
"
,
"
title
"
:
"
space
"
},
"
Check sub documents
"
);
o
.
local_jio
.
get
({
"
_id
"
:
"
blue
"
},
o
.
f
);
o
.
tick
(
o
);
...
...
@@ -8214,6 +8238,7 @@ test("Remove", function () {
"
application_name
"
:
"
gid storage remove test
"
};
// local jio is going to help us to prepare localstorage for gid tests
o
.
local_jio
=
JIO
.
newJio
(
o
.
localstorage_spec
);
o
.
jio
=
JIO
.
newJio
({
...
...
@@ -8221,34 +8246,39 @@ test("Remove", function () {
"
sub_storage
"
:
o
.
localstorage_spec
,
"
constraints
"
:
{
"
default
"
:
{
"
identifie
r
"
:
"
list
"
"
creato
r
"
:
"
list
"
}
}
});
o
.
local_jio
.
put
({
"
_id
"
:
"
blue
"
,
"
identifier
"
:
"
a
"
});
o
.
local_jio
.
put
({
"
_id
"
:
"
green
"
,
"
identifier
"
:
[
"
ac
"
,
"
b
"
]});
// preparing localstorage with documents
o
.
local_jio
.
put
({
"
_id
"
:
"
blue
"
,
"
creator
"
:
"
a
"
,
"
title
"
:
"
earth
"
});
o
.
local_jio
.
put
({
"
_id
"
:
"
green
"
,
"
creator
"
:
[
"
ac
"
,
"
b
"
],
"
title
"
:
"
wind
"
});
o
.
clock
.
tick
(
2000
);
o
.
local_jio
.
stop
();
// Fail to remove document because given gid does not respect constraints
o
.
spy
(
o
,
'
status
'
,
400
,
'
Remove document without respecting constraints
'
+
'
-> bad request
'
);
o
.
jio
.
remove
({
"
_id
"
:
"
a
"
},
o
.
f
);
o
.
tick
(
o
);
// Succeed to remove
o
.
spy
(
o
,
'
value
'
,
{
"
ok
"
:
true
,
"
id
"
:
"
{
\"
identifie
r
\"
:[
\"
b
\"
]}
"
"
id
"
:
"
{
\"
creato
r
\"
:[
\"
b
\"
]}
"
},
'
Remove document
'
);
o
.
jio
.
remove
({
"
_id
"
:
"
{
\"
identifie
r
\"
:[
\"
b
\"
]}
"
"
_id
"
:
"
{
\"
creato
r
\"
:[
\"
b
\"
]}
"
},
o
.
f
);
o
.
tick
(
o
);
// Fail to remove the same document. This test checks also that only one
// document matches the gid constraints
o
.
spy
(
o
,
'
status
'
,
404
,
'
Remove inexistent document
'
);
o
.
jio
.
remove
({
"
_id
"
:
"
{
\"
identifie
r
\"
:[
\"
b
\"
]}
"
"
_id
"
:
"
{
\"
creato
r
\"
:[
\"
b
\"
]}
"
},
o
.
f
);
o
.
tick
(
o
);
...
...
@@ -8264,6 +8294,7 @@ test("putAttachment", function () {
"
application_name
"
:
"
gid storage put attachment test
"
};
// local jio is going to help us to prepare localstorage for gid tests
o
.
local_jio
=
JIO
.
newJio
(
o
.
localstorage_spec
);
o
.
jio
=
JIO
.
newJio
({
...
...
@@ -8271,15 +8302,17 @@ test("putAttachment", function () {
"
sub_storage
"
:
o
.
localstorage_spec
,
"
constraints
"
:
{
"
default
"
:
{
"
identifie
r
"
:
"
list
"
"
creato
r
"
:
"
list
"
}
}
});
o
.
local_jio
.
put
({
"
_id
"
:
"
blue
"
,
"
identifier
"
:
"
a
"
});
o
.
local_jio
.
put
({
"
_id
"
:
"
green
"
,
"
identifier
"
:
[
"
ac
"
,
"
b
"
]});
// preparing localstorage with documents
o
.
local_jio
.
put
({
"
_id
"
:
"
blue
"
,
"
creator
"
:
"
a
"
,
"
title
"
:
"
earth
"
});
o
.
local_jio
.
put
({
"
_id
"
:
"
green
"
,
"
creator
"
:
[
"
ac
"
,
"
b
"
],
"
title
"
:
"
wind
"
});
o
.
clock
.
tick
(
2000
);
// Fail to put attachment because given gid doesn't respect constraints
o
.
spy
(
o
,
'
status
'
,
400
,
'
put attachment without respecting constraints
'
+
'
-> bad request
'
);
o
.
jio
.
putAttachment
({
...
...
@@ -8290,36 +8323,40 @@ test("putAttachment", function () {
},
o
.
f
);
o
.
tick
(
o
);
// Succeed to put an attachment to a document
o
.
spy
(
o
,
'
value
'
,
{
"
ok
"
:
true
,
"
id
"
:
"
{
\"
identifie
r
\"
:[
\"
b
\"
]}
"
,
"
id
"
:
"
{
\"
creato
r
\"
:[
\"
b
\"
]}
"
,
"
attachment
"
:
"
body
"
},
'
put attachment
'
);
o
.
jio
.
putAttachment
({
"
_id
"
:
"
{
\"
identifie
r
\"
:[
\"
b
\"
]}
"
,
"
_id
"
:
"
{
\"
creato
r
\"
:[
\"
b
\"
]}
"
,
"
_attachment
"
:
"
body
"
,
"
_data
"
:
"
abc
"
,
"
_mimetype
"
:
"
text/plain
"
},
o
.
f
);
o
.
tick
(
o
);
// Check if the local storage document really have the new attachment
o
.
spy
(
o
,
'
value
'
,
"
abc
"
,
"
Check attachment
"
);
o
.
local_jio
.
getAttachment
({
"
_id
"
:
"
green
"
,
"
_attachment
"
:
"
body
"
},
o
.
f
);
o
.
tick
(
o
);
// Succeed to update an attachment
o
.
spy
(
o
,
'
value
'
,
{
"
ok
"
:
true
,
"
id
"
:
"
{
\"
identifie
r
\"
:[
\"
b
\"
]}
"
,
"
id
"
:
"
{
\"
creato
r
\"
:[
\"
b
\"
]}
"
,
"
attachment
"
:
"
body
"
},
'
put attachment
'
);
o
.
jio
.
putAttachment
({
"
_id
"
:
"
{
\"
identifie
r
\"
:[
\"
b
\"
]}
"
,
"
_id
"
:
"
{
\"
creato
r
\"
:[
\"
b
\"
]}
"
,
"
_attachment
"
:
"
body
"
,
"
_data
"
:
"
def
"
,
"
_mimetype
"
:
"
text/plain
"
},
o
.
f
);
o
.
tick
(
o
);
// Check if the local storage attachment really changed
o
.
spy
(
o
,
'
value
'
,
"
def
"
,
"
Check attachment
"
);
o
.
local_jio
.
getAttachment
({
"
_id
"
:
"
green
"
,
"
_attachment
"
:
"
body
"
},
o
.
f
);
o
.
tick
(
o
);
...
...
@@ -8337,6 +8374,7 @@ test("getAttachment", function () {
"
application_name
"
:
"
gid storage get attachment test
"
};
// local jio is going to help us to prepare localstorage for gid tests
o
.
local_jio
=
JIO
.
newJio
(
o
.
localstorage_spec
);
o
.
jio
=
JIO
.
newJio
({
...
...
@@ -8344,15 +8382,17 @@ test("getAttachment", function () {
"
sub_storage
"
:
o
.
localstorage_spec
,
"
constraints
"
:
{
"
default
"
:
{
"
identifie
r
"
:
"
list
"
"
creato
r
"
:
"
list
"
}
}
});
o
.
local_jio
.
put
({
"
_id
"
:
"
blue
"
,
"
identifier
"
:
"
a
"
});
o
.
local_jio
.
put
({
"
_id
"
:
"
green
"
,
"
identifier
"
:
[
"
ac
"
,
"
b
"
]});
// preparing localstorage with documents
o
.
local_jio
.
put
({
"
_id
"
:
"
blue
"
,
"
creator
"
:
"
a
"
,
"
title
"
:
"
earth
"
});
o
.
local_jio
.
put
({
"
_id
"
:
"
green
"
,
"
creator
"
:
[
"
ac
"
,
"
b
"
],
"
title
"
:
"
wind
"
});
o
.
clock
.
tick
(
2000
);
// Fail to get attachment because given gid doesn't respect constraints
o
.
spy
(
o
,
'
status
'
,
400
,
'
get attachment without respecting constraints
'
+
'
-> bad request
'
);
o
.
jio
.
getAttachment
({
...
...
@@ -8361,13 +8401,15 @@ test("getAttachment", function () {
},
o
.
f
);
o
.
tick
(
o
);
// Fail to get an inexistent attachment from a document
o
.
spy
(
o
,
'
status
'
,
404
,
'
Get inexistent attachment
'
);
o
.
jio
.
getAttachment
({
"
_id
"
:
"
{
\"
identifie
r
\"
:[
\"
a
\"
]}
"
,
"
_id
"
:
"
{
\"
creato
r
\"
:[
\"
a
\"
]}
"
,
"
_attachment
"
:
"
body
"
},
o
.
f
);
o
.
tick
(
o
);
// Add an attachment manually to the document 'blue'
o
.
local_jio
.
putAttachment
({
"
_id
"
:
"
blue
"
,
"
_attachment
"
:
"
body
"
,
...
...
@@ -8377,9 +8419,10 @@ test("getAttachment", function () {
o
.
clock
.
tick
(
2000
);
o
.
local_jio
.
stop
();
// Succeed to get the previous attachment
o
.
spy
(
o
,
'
value
'
,
"
lol
"
,
'
Get attachment
'
);
o
.
jio
.
getAttachment
({
"
_id
"
:
"
{
\"
identifie
r
\"
:[
\"
a
\"
]}
"
,
"
_id
"
:
"
{
\"
creato
r
\"
:[
\"
a
\"
]}
"
,
"
_attachment
"
:
"
body
"
},
o
.
f
);
o
.
tick
(
o
);
...
...
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