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
Xiaowu Zhang
slapos.core
Commits
1a1f8a79
Commit
1a1f8a79
authored
Aug 12, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cover low level tests of cyclic detection.
Moreover update existing tests in order to simulate real cases.
parent
878461b9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
6 deletions
+85
-6
master/product/Vifib/tests/testVifibSlapWebService.py
master/product/Vifib/tests/testVifibSlapWebService.py
+85
-6
No files found.
master/product/Vifib/tests/testVifibSlapWebService.py
View file @
1a1f8a79
...
@@ -8357,6 +8357,7 @@ class TestVifibSlapWebService(testVifibMixin):
...
@@ -8357,6 +8357,7 @@ class TestVifibSlapWebService(testVifibMixin):
software_instance
=
self
.
portal
.
software_instance_module
.
newContent
(
software_instance
=
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
'Software Instance'
)
portal_type
=
'Software Instance'
)
self
.
checkConnected
=
software_instance
.
checkConnected
self
.
checkConnected
=
software_instance
.
checkConnected
self
.
checkNotCyclic
=
software_instance
.
checkNotCyclic
def
test_si_tree_simple_connected
(
self
):
def
test_si_tree_simple_connected
(
self
):
"""Graph of one element is connected
"""Graph of one element is connected
...
@@ -8425,10 +8426,10 @@ class TestVifibSlapWebService(testVifibMixin):
...
@@ -8425,10 +8426,10 @@ class TestVifibSlapWebService(testVifibMixin):
def
test_si_tree_cyclic_disconnected
(
self
):
def
test_si_tree_cyclic_disconnected
(
self
):
"""Two trees, where one is cyclic are disconnected
"""Two trees, where one is cyclic are disconnected
B --> A
B --> A
<-
\
\
-> H
\
-> H
--/
C --> D --> G
C --> D --> G
<-
\
\
-> E --> F
\
-> E --> F
--/
"""
"""
self
.
_test_si_tree
()
self
.
_test_si_tree
()
graph
=
{
graph
=
{
...
@@ -8437,15 +8438,93 @@ class TestVifibSlapWebService(testVifibMixin):
...
@@ -8437,15 +8438,93 @@ class TestVifibSlapWebService(testVifibMixin):
'C'
:
[
'D'
,
'E'
],
'C'
:
[
'D'
,
'E'
],
'D'
:
[
'G'
],
'D'
:
[
'G'
],
'E'
:
[
'F'
],
'E'
:
[
'F'
],
'F'
:
[],
'F'
:
[
'G'
],
'G'
:
[],
'G'
:
[],
'H'
:
[],
'H'
:
[
'A'
],
}
}
root
=
'B'
root
=
'B'
from
erp5.document.SoftwareInstance
import
DisconnectedSoftwareTree
from
erp5.document.SoftwareInstance
import
DisconnectedSoftwareTree
self
.
assertRaises
(
DisconnectedSoftwareTree
,
self
.
checkConnected
,
graph
,
self
.
assertRaises
(
DisconnectedSoftwareTree
,
self
.
checkConnected
,
graph
,
root
)
root
)
def
test_si_tree_simple_not_cyclic
(
self
):
"""Graph of one element is not cyclic
A
"""
self
.
_test_si_tree
()
graph
=
{
'A'
:
[]}
self
.
assertEqual
(
True
,
self
.
checkNotCyclic
(
graph
))
def
test_si_tree_simple_list_not_cyclic
(
self
):
"""Graph of list is not cyclic
B->C->A
"""
self
.
_test_si_tree
()
graph
=
{
'A'
:
[],
'B'
:
[
'C'
],
'C'
:
[
'A'
]}
self
.
assertEqual
(
True
,
self
.
checkNotCyclic
(
graph
))
def
test_si_tree_complex_not_cyclic
(
self
):
"""Tree is not cyclic
B --> A
\
-> C --> D
\
-> E --> F
"""
self
.
_test_si_tree
()
graph
=
{
'A'
:
[],
'B'
:
[
'A'
,
'C'
],
'C'
:
[
'D'
,
'E'
],
'D'
:
[],
'E'
:
[
'F'
],
'F'
:
[],
}
self
.
assertEqual
(
True
,
self
.
checkNotCyclic
(
graph
))
def
test_si_tree_simple_list_disconnected_not_cyclic
(
self
):
"""Two lists are disconnected
A->B
C
"""
self
.
_test_si_tree
()
graph
=
{
'A'
:
[
'B'
],
'B'
:
[],
'C'
:
[]}
self
.
assertEqual
(
True
,
self
.
checkNotCyclic
(
graph
))
def
test_si_tree_cyclic
(
self
):
"""Cyclic is connected
A<->B
"""
self
.
_test_si_tree
()
graph
=
{
'A'
:
[
'B'
],
'B'
:
[
'A'
]}
from
erp5.document.SoftwareInstance
import
CyclicSoftwareTree
self
.
assertRaises
(
CyclicSoftwareTree
,
self
.
checkNotCyclic
,
graph
)
def
test_si_tree_cyclic_disconnected_cyclic
(
self
):
"""Two trees, where one is cyclic are disconnected
B --> A <-
\
\
-> H --/
C --> D --> G <-
\
\
-> E --> F --/
"""
self
.
_test_si_tree
()
graph
=
{
'A'
:
[],
'B'
:
[
'A'
,
'H'
],
'C'
:
[
'D'
,
'E'
],
'D'
:
[
'G'
],
'E'
:
[
'F'
],
'F'
:
[
'G'
],
'G'
:
[],
'H'
:
[
'A'
],
}
from
erp5.document.SoftwareInstance
import
CyclicSoftwareTree
self
.
assertRaises
(
CyclicSoftwareTree
,
self
.
checkNotCyclic
,
graph
)
########################################
########################################
# Other tests
# Other tests
########################################
########################################
...
...
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