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
Paul Graydon
slapos.core
Commits
faa27004
Commit
faa27004
authored
May 29, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use assertIsInstance()
parent
b6b975a7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
23 deletions
+14
-23
slapos/tests/slap.py
slapos/tests/slap.py
+14
-23
No files found.
slapos/tests/slap.py
View file @
faa27004
...
...
@@ -113,7 +113,7 @@ class TestSlap(SlapMixin):
self
.
slap
=
slapos
.
slap
.
slap
()
self
.
slap
.
initializeConnection
(
self
.
server_url
)
computer
=
self
.
slap
.
registerComputer
(
computer_guid
)
self
.
assert
True
(
isinstance
(
computer
,
slapos
.
slap
.
Computer
)
)
self
.
assert
IsInstance
(
computer
,
slapos
.
slap
.
Computer
)
def
test_registerComputer_with_existing_guid
(
self
):
"""
...
...
@@ -124,10 +124,10 @@ class TestSlap(SlapMixin):
self
.
slap
=
slapos
.
slap
.
slap
()
self
.
slap
.
initializeConnection
(
self
.
server_url
)
computer
=
self
.
slap
.
registerComputer
(
computer_guid
)
self
.
assert
True
(
isinstance
(
computer
,
slapos
.
slap
.
Computer
)
)
self
.
assert
IsInstance
(
computer
,
slapos
.
slap
.
Computer
)
computer2
=
self
.
slap
.
registerComputer
(
computer_guid
)
self
.
assert
True
(
isinstance
(
computer2
,
slapos
.
slap
.
Computer
)
)
self
.
assert
IsInstance
(
computer2
,
slapos
.
slap
.
Computer
)
# XXX: There is naming conflict in slap library.
# SoftwareRelease is currently used as suboject of Slap transmission object
...
...
@@ -140,8 +140,7 @@ class TestSlap(SlapMixin):
self
.
slap
=
slapos
.
slap
.
slap
()
self
.
slap
.
initializeConnection
(
self
.
server_url
)
software_release
=
self
.
slap
.
registerSoftwareRelease
(
software_release_uri
)
self
.
assertTrue
(
isinstance
(
software_release
,
slapos
.
slap
.
SoftwareRelease
))
self
.
assertIsInstance
(
software_release
,
slapos
.
slap
.
SoftwareRelease
)
def
test_registerSoftwareRelease_with_existing_uri
(
self
):
"""
...
...
@@ -152,12 +151,10 @@ class TestSlap(SlapMixin):
self
.
slap
=
slapos
.
slap
.
slap
()
self
.
slap
.
initializeConnection
(
self
.
server_url
)
software_release
=
self
.
slap
.
registerSoftwareRelease
(
software_release_uri
)
self
.
assertTrue
(
isinstance
(
software_release
,
slapos
.
slap
.
SoftwareRelease
))
self
.
assertIsInstance
(
software_release
,
slapos
.
slap
.
SoftwareRelease
)
software_release2
=
self
.
slap
.
registerSoftwareRelease
(
software_release_uri
)
self
.
assertTrue
(
isinstance
(
software_release2
,
slapos
.
slap
.
SoftwareRelease
))
self
.
assertIsInstance
(
software_release2
,
slapos
.
slap
.
SoftwareRelease
)
def
test_registerComputerPartition_new_partition_id_known_computer_guid
(
self
):
"""
...
...
@@ -183,7 +180,7 @@ class TestSlap(SlapMixin):
httplib
.
HTTPConnection
.
_callback
=
server_response
partition
=
self
.
slap
.
registerComputerPartition
(
computer_guid
,
partition_id
)
self
.
assert
True
(
isinstance
(
partition
,
slapos
.
slap
.
ComputerPartition
)
)
self
.
assert
IsInstance
(
partition
,
slapos
.
slap
.
ComputerPartition
)
def
test_registerComputerPartition_existing_partition_id_known_computer_guid
(
self
):
"""
...
...
@@ -193,7 +190,7 @@ class TestSlap(SlapMixin):
self
.
test_registerComputerPartition_new_partition_id_known_computer_guid
()
partition
=
self
.
slap
.
registerComputerPartition
(
self
.
_getTestComputerId
(),
self
.
partition_id
)
self
.
assert
True
(
isinstance
(
partition
,
slapos
.
slap
.
ComputerPartition
)
)
self
.
assert
IsInstance
(
partition
,
slapos
.
slap
.
ComputerPartition
)
def
test_registerComputerPartition_unknown_computer_guid
(
self
):
"""
...
...
@@ -487,8 +484,7 @@ class TestComputerPartition(SlapMixin):
'http://server/new/'
+
self
.
_getTestComputerId
(),
'software_type'
,
'myref'
)
self
.
assertTrue
(
isinstance
(
requested_partition
,
slapos
.
slap
.
ComputerPartition
))
self
.
assertIsInstance
(
requested_partition
,
slapos
.
slap
.
ComputerPartition
)
def
test_request_raises_later
(
self
):
partition_id
=
'PARTITION_01'
...
...
@@ -525,8 +521,7 @@ class TestComputerPartition(SlapMixin):
'http://server/new/'
+
self
.
_getTestComputerId
(),
'software_type'
,
'myref'
)
self
.
assertTrue
(
isinstance
(
requested_partition
,
slapos
.
slap
.
ComputerPartition
))
self
.
assertIsInstance
(
requested_partition
,
slapos
.
slap
.
ComputerPartition
)
# as request method does not raise, accessing data raises
self
.
assertRaises
(
slapos
.
slap
.
ResourceNotReady
,
requested_partition
.
getId
)
...
...
@@ -571,8 +566,7 @@ class TestComputerPartition(SlapMixin):
'http://server/new/'
+
self
.
_getTestComputerId
(),
'software_type'
,
'myref'
)
self
.
assertTrue
(
isinstance
(
requested_partition
,
slapos
.
slap
.
ComputerPartition
))
self
.
assertIsInstance
(
requested_partition
,
slapos
.
slap
.
ComputerPartition
)
# as request method does not raise, accessing data in case when
# request was done works correctly
self
.
assertEqual
(
requested_partition_id
,
requested_partition
.
getId
())
...
...
@@ -746,8 +740,7 @@ class TestOpenOrder(SlapMixin):
# XXX: Interface lack registerOpenOrder method declaration
open_order
=
self
.
slap
.
registerOpenOrder
()
computer_partition
=
open_order
.
request
(
software_release_uri
,
'myrefe'
)
self
.
assertTrue
(
isinstance
(
computer_partition
,
slapos
.
slap
.
ComputerPartition
))
self
.
assertIsInstance
(
computer_partition
,
slapos
.
slap
.
ComputerPartition
)
def
test_request_raises_later
(
self
):
software_release_uri
=
'http://server/new/'
+
self
.
_getTestComputerId
()
...
...
@@ -759,8 +752,7 @@ class TestOpenOrder(SlapMixin):
return
(
408
,
{},
''
)
httplib
.
HTTPConnection
.
_callback
=
server_response
computer_partition
=
open_order
.
request
(
software_release_uri
,
'myrefe'
)
self
.
assertTrue
(
isinstance
(
computer_partition
,
slapos
.
slap
.
ComputerPartition
))
self
.
assertIsInstance
(
computer_partition
,
slapos
.
slap
.
ComputerPartition
)
self
.
assertRaises
(
slapos
.
slap
.
ResourceNotReady
,
computer_partition
.
getId
)
...
...
@@ -781,8 +773,7 @@ class TestOpenOrder(SlapMixin):
httplib
.
HTTPConnection
.
_callback
=
server_response
computer_partition
=
open_order
.
request
(
software_release_uri
,
'myrefe'
)
self
.
assertTrue
(
isinstance
(
computer_partition
,
slapos
.
slap
.
ComputerPartition
))
self
.
assertIsInstance
(
computer_partition
,
slapos
.
slap
.
ComputerPartition
)
self
.
assertEqual
(
requested_partition_id
,
computer_partition
.
getId
())
if
__name__
==
'__main__'
:
...
...
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