Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Titouan Soulard
slapos.core
Commits
663a0272
Commit
663a0272
authored
May 02, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cover raise on server side.
parent
e801530c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
1 deletion
+39
-1
master/bt5/vifib_slapos_rest_api_v1_test/TestTemplateItem/testVifibSlaposRestAPIV1.py
..._api_v1_test/TestTemplateItem/testVifibSlaposRestAPIV1.py
+38
-0
master/bt5/vifib_slapos_rest_api_v1_test/bt/revision
master/bt5/vifib_slapos_rest_api_v1_test/bt/revision
+1
-1
No files found.
master/bt5/vifib_slapos_rest_api_v1_test/TestTemplateItem/testVifibSlaposRestAPIV1.py
View file @
663a0272
...
@@ -14,6 +14,14 @@ class Person_requestSoftwareInstanceSimulator:
...
@@ -14,6 +14,14 @@ class Person_requestSoftwareInstanceSimulator:
"""Simulation Method"""
"""Simulation Method"""
open
(
self
.
outfile
,
'a'
).
write
(
'recargs = %r
\
n
reckwargs = %r'
%
(
args
,
kwargs
))
open
(
self
.
outfile
,
'a'
).
write
(
'recargs = %r
\
n
reckwargs = %r'
%
(
args
,
kwargs
))
class
Person_requestSoftwareInstanceRaisingSimulator
(
Person_requestSoftwareInstanceSimulator
):
def
__init__
(
self
,
exception
):
self
.
exception
=
exception
def
__call__
(
self
,
*
args
,
**
kwargs
):
"""Simulation Method"""
raise
self
.
exception
class
TestVifibSlaposRestAPIV1
(
ERP5TypeTestCase
):
class
TestVifibSlaposRestAPIV1
(
ERP5TypeTestCase
):
def
generateNewId
(
self
):
def
generateNewId
(
self
):
return
str
(
self
.
getPortalObject
().
portal_ids
.
generateNewId
(
return
str
(
self
.
getPortalObject
().
portal_ids
.
generateNewId
(
...
@@ -220,3 +228,33 @@ class TestVifibSlaposRestAPIV1(ERP5TypeTestCase):
...
@@ -220,3 +228,33 @@ class TestVifibSlaposRestAPIV1(ERP5TypeTestCase):
"status"
:
"processing"
,
"status"
:
"processing"
,
},
},
self
.
json_response
)
self
.
json_response
)
def
test_request_correct_server_side_raise
(
self
):
self
.
customer
.
requestSoftwareInstance
=
\
Person_requestSoftwareInstanceRaisingSimulator
(
AttributeError
)
transaction
.
commit
()
kwargs
=
{
'parameter'
:
{
'Custom1'
:
'one string'
,
'Custom2'
:
'one float'
,
'Custom3'
:
[
'abc'
,
'def'
]},
'title'
:
'My unique instance'
,
'software_release'
:
'http://example.com/example.cfg'
,
'status'
:
'started'
,
'sla'
:
{
'computer_id'
:
'COMP-0'
},
'software_type'
:
'type_provided_by_the_software'
,
'slave'
:
True
}
self
.
connection
.
request
(
method
=
'POST'
,
url
=
'/'
.
join
([
self
.
api_path
,
'instance'
]),
body
=
json
.
dumps
(
kwargs
),
headers
=
{
'REMOTE_USER'
:
self
.
customer_reference
})
self
.
prepareResponse
()
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
500
)
self
.
assertResponseJson
()
self
.
assertEqual
({
"error"
:
"There is system issue, please try again later"
,
},
self
.
json_response
)
self
.
assertSimulatorEmpty
()
master/bt5/vifib_slapos_rest_api_v1_test/bt/revision
View file @
663a0272
3
4
\ No newline at end of file
\ No newline at end of file
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