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
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Rafael Monnerat
slapos.core
Commits
98d6da7d
Commit
98d6da7d
authored
May 21, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cover basic cases specific to Computer.PUT.
parent
61eeec57
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
146 additions
and
6 deletions
+146
-6
master/bt5/vifib_slapos_rest_api_v1_test/TestTemplateItem/testVifibSlaposRestAPIV1.py
..._api_v1_test/TestTemplateItem/testVifibSlaposRestAPIV1.py
+145
-5
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 @
98d6da7d
...
@@ -1531,16 +1531,156 @@ class TestComputerPUT(VifibSlaposRestAPIV1MixinBase):
...
@@ -1531,16 +1531,156 @@ class TestComputerPUT(VifibSlaposRestAPIV1MixinBase):
self
.
assertComputerPUTSimulatorEmpty
()
self
.
assertComputerPUTSimulatorEmpty
()
def
test_software_release_status
(
self
):
def
test_software_release_status
(
self
):
raise
NotImplementedError
d
=
{
"partition"
:
[
{
"title"
:
"part0"
,
"public_ip"
:
"::0"
,
"private_ip"
:
"127.0.0.0"
,
"tap_interface"
:
"tap0"
}
],
"software"
:
[
{
"software_release"
:
"software_release"
,
"status"
:
"wrong status"
,
"log"
:
"Installation log"
}
]
}
self
.
connection
.
request
(
method
=
'PUT'
,
url
=
'/'
.
join
([
self
.
api_path
,
'computer'
,
self
.
computer
.
getRelativeUrl
()]),
body
=
json
.
dumps
(
d
),
headers
=
{
'REMOTE_USER'
:
self
.
computer_reference
})
self
.
prepareResponse
()
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
400
)
self
.
assertResponseJson
()
self
.
assertEqual
({
'software_0'
:
[
'Status "wrong status" is incorrect.'
]},
self
.
json_response
)
self
.
assertComputerPUTSimulatorEmpty
()
def
test_only_partition
(
self
):
def
test_only_partition
(
self
):
raise
NotImplementedError
d
=
{
"partition"
:
[
{
"title"
:
"part0"
,
"public_ip"
:
"::0"
,
"private_ip"
:
"127.0.0.0"
,
"tap_interface"
:
"tap0"
}
]
}
self
.
connection
.
request
(
method
=
'PUT'
,
url
=
'/'
.
join
([
self
.
api_path
,
'computer'
,
self
.
computer
.
getRelativeUrl
()]),
body
=
json
.
dumps
(
d
),
headers
=
{
'REMOTE_USER'
:
self
.
computer_reference
})
self
.
prepareResponse
()
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
204
)
self
.
assertComputerPUTSimulator
([
{
'recmethod'
:
'Computer_updateFromJson'
,
'recargs'
:
({
'partition'
:
[{
'public_ip'
:
'::0'
,
'tap_interface'
:
'tap0'
,
'private_ip'
:
'127.0.0.0'
,
'title'
:
'part0'
}],
},),
'reckwargs'
:
{}}])
def
test_only_software
(
self
):
def
test_only_software
(
self
):
raise
NotImplementedError
d
=
{
"software"
:
[
{
"software_release"
:
"software_release"
,
"status"
:
"uninstalled"
,
"log"
:
"Installation log"
}
]
}
self
.
connection
.
request
(
method
=
'PUT'
,
url
=
'/'
.
join
([
self
.
api_path
,
'computer'
,
self
.
computer
.
getRelativeUrl
()]),
body
=
json
.
dumps
(
d
),
headers
=
{
'REMOTE_USER'
:
self
.
computer_reference
})
self
.
prepareResponse
()
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
204
)
self
.
assertComputerPUTSimulator
([
{
'recmethod'
:
'Computer_updateFromJson'
,
'recargs'
:
({
'software'
:
[{
'status'
:
'uninstalled'
,
'software_release'
:
'software_release'
,
'log'
:
'Installation log'
}]},),
'reckwargs'
:
{}}])
def
test_partition_object_incorrect
(
self
):
def
test_partition_object_incorrect
(
self
):
raise
NotImplementedError
d
=
{
"partition"
:
[
{
"title"
:
"part0"
,
"public_ip"
:
"::0"
,
"private_ip"
:
"127.0.0.0"
}
],
"software"
:
[
{
"software_release"
:
"software_release"
,
"status"
:
"uninstalled"
,
"log"
:
"Installation log"
}
]
}
self
.
connection
.
request
(
method
=
'PUT'
,
url
=
'/'
.
join
([
self
.
api_path
,
'computer'
,
self
.
computer
.
getRelativeUrl
()]),
body
=
json
.
dumps
(
d
),
headers
=
{
'REMOTE_USER'
:
self
.
computer_reference
})
self
.
prepareResponse
()
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
400
)
self
.
assertResponseJson
()
self
.
assertEqual
({
'partition_0'
:
[
'Missing key "tap_interface".'
]},
self
.
json_response
)
self
.
assertComputerPUTSimulatorEmpty
()
def
test_software_object_incorrect
(
self
):
def
test_software_object_incorrect
(
self
):
raise
NotImplementedError
d
=
{
"partition"
:
[
{
"title"
:
"part0"
,
"public_ip"
:
"::0"
,
"private_ip"
:
"127.0.0.0"
,
"tap_interface"
:
"tap0"
}
],
"software"
:
[
{
"software_release"
:
"software_release"
,
"status"
:
"uninstalled"
,
}
]
}
self
.
connection
.
request
(
method
=
'PUT'
,
url
=
'/'
.
join
([
self
.
api_path
,
'computer'
,
self
.
computer
.
getRelativeUrl
()]),
body
=
json
.
dumps
(
d
),
headers
=
{
'REMOTE_USER'
:
self
.
computer_reference
})
self
.
prepareResponse
()
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
400
)
self
.
assertResponseJson
()
self
.
assertEqual
({
'software_0'
:
[
'Missing key "log".'
]},
self
.
json_response
)
self
.
assertComputerPUTSimulatorEmpty
()
master/bt5/vifib_slapos_rest_api_v1_test/bt/revision
View file @
98d6da7d
59
60
\ 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