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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Romain Courteaud
jio
Commits
48ea995c
Commit
48ea995c
authored
May 07, 2021
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5storage] handle non existing view
Return a 404 jIOError.
parent
dcca4e59
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
src/jio.storage/erp5storage.js
src/jio.storage/erp5storage.js
+7
-0
test/jio.storage/erp5storage.tests.js
test/jio.storage/erp5storage.tests.js
+29
-0
No files found.
src/jio.storage/erp5storage.js
View file @
48ea995c
...
@@ -365,6 +365,13 @@
...
@@ -365,6 +365,13 @@
);
);
}
}
return
evt
.
target
.
response
;
return
evt
.
target
.
response
;
},
function
(
error
)
{
if
((
error
.
target
!==
undefined
)
&&
(
error
.
target
.
status
===
404
))
{
throw
new
jIO
.
util
.
jIOError
(
"
Cannot find attachment:
"
+
action
,
404
);
}
throw
error
;
});
});
}
}
throw
new
jIO
.
util
.
jIOError
(
"
ERP5: not support get attachment:
"
+
action
,
throw
new
jIO
.
util
.
jIOError
(
"
ERP5: not support get attachment:
"
+
action
,
...
...
test/jio.storage/erp5storage.tests.js
View file @
48ea995c
...
@@ -965,6 +965,35 @@
...
@@ -965,6 +965,35 @@
});
});
});
});
test
(
"
getAttachment: view on inexistent view
"
,
function
()
{
var
id
=
"
person_module/1
"
,
traverse_url
=
domain
+
"
?mode=traverse&relative_url=
"
+
encodeURIComponent
(
id
)
+
"
&view=foo_view
"
;
this
.
server
.
respondWith
(
"
GET
"
,
domain
,
[
200
,
{
"
Content-Type
"
:
"
application/hal+json
"
},
root_hateoas
]);
this
.
server
.
respondWith
(
"
GET
"
,
traverse_url
,
[
404
,
{
"
Content-Type
"
:
"
text/html
"
},
""
]);
stop
();
expect
(
3
);
this
.
jio
.
getAttachment
(
id
,
traverse_url
)
.
fail
(
function
(
error
)
{
ok
(
error
instanceof
jIO
.
util
.
jIOError
);
equal
(
error
.
message
,
"
Cannot find attachment:
"
+
traverse_url
);
equal
(
error
.
status_code
,
404
);
})
.
fail
(
function
(
error
)
{
ok
(
false
,
error
);
})
.
always
(
function
()
{
start
();
});
});
test
(
"
getAttachment: view uses default form with access token
"
,
function
()
{
test
(
"
getAttachment: view uses default form with access token
"
,
function
()
{
var
id
=
"
person_module/1
"
,
var
id
=
"
person_module/1
"
,
traverse_url
=
domain
+
"
?mode=traverse&relative_url=
"
+
traverse_url
=
domain
+
"
?mode=traverse&relative_url=
"
+
...
...
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