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
Boxiang Sun
slapos.core
Commits
6f46e4e2
Commit
6f46e4e2
authored
May 18, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reply nicely in case of wrong status.
parent
cdc5c9c2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
1 deletion
+33
-1
master/bt5/vifib_slapos_rest_api_v1_test/TestTemplateItem/testVifibSlaposRestAPIV1.py
..._api_v1_test/TestTemplateItem/testVifibSlaposRestAPIV1.py
+27
-0
master/bt5/vifib_slapos_rest_api_v1_test/bt/revision
master/bt5/vifib_slapos_rest_api_v1_test/bt/revision
+1
-1
master/product/Vifib/Tool/VifibRestApiV1Tool.py
master/product/Vifib/Tool/VifibRestApiV1Tool.py
+5
-0
No files found.
master/bt5/vifib_slapos_rest_api_v1_test/TestTemplateItem/testVifibSlaposRestAPIV1.py
View file @
6f46e4e2
...
@@ -282,6 +282,33 @@ class TestInstanceRequest(VifibSlaposRestAPIV1Mixin):
...
@@ -282,6 +282,33 @@ class TestInstanceRequest(VifibSlaposRestAPIV1Mixin):
self
.
json_response
)
self
.
json_response
)
self
.
assertPersonRequestSimulatorEmpty
()
self
.
assertPersonRequestSimulatorEmpty
()
def
test_incorrect_status
(
self
):
kwargs
=
{
'parameter'
:
{
'Custom1'
:
'one string'
,
'Custom2'
:
'one float'
,
'Custom3'
:
[
'abc'
,
'def'
]},
'title'
:
'My unique instance'
,
'software_release'
:
'http://example.com/example.cfg'
,
'status'
:
'badstatus'
,
'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
(
400
)
self
.
assertResponseJson
()
self
.
assertEqual
({
"status"
:
"Status shall be one of: started, stopped, destroyed."
,
},
self
.
json_response
)
self
.
assertPersonRequestSimulatorEmpty
()
def
test_correct
(
self
):
def
test_correct
(
self
):
kwargs
=
{
kwargs
=
{
'parameter'
:
{
'parameter'
:
{
...
...
master/bt5/vifib_slapos_rest_api_v1_test/bt/revision
View file @
6f46e4e2
55
56
\ No newline at end of file
\ No newline at end of file
master/product/Vifib/Tool/VifibRestApiV1Tool.py
View file @
6f46e4e2
...
@@ -318,6 +318,11 @@ class InstancePublisher(GenericPublisher):
...
@@ -318,6 +318,11 @@ class InstancePublisher(GenericPublisher):
):
):
request_dict
[
k_i
]
=
self
.
jbody
[
k_j
]
request_dict
[
k_i
]
=
self
.
jbody
[
k_j
]
if
request_dict
[
'state'
]
not
in
[
'started'
,
'stopped'
,
'destroyed'
]:
self
.
REQUEST
.
response
.
setStatus
(
400
)
self
.
REQUEST
.
response
.
setBody
(
jsonify
(
{
'status'
:
'Status shall be one of: started, stopped, destroyed.'
}))
return
self
.
REQUEST
.
response
try
:
try
:
self
.
restrictedTraverse
(
self
.
person_url
self
.
restrictedTraverse
(
self
.
person_url
).
requestSoftwareInstance
(
**
request_dict
)
).
requestSoftwareInstance
(
**
request_dict
)
...
...
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