diff options
Diffstat (limited to 'src/workflow/tests')
-rw-r--r-- | src/workflow/tests/__init__.py | 8 | ||||
-rw-r--r-- | src/workflow/tests/constants.py | 198 | ||||
-rw-r--r-- | src/workflow/tests/test_fixtures.py | 2 | ||||
-rw-r--r-- | src/workflow/tests/test_steps.py | 269 | ||||
-rw-r--r-- | src/workflow/tests/test_workflows.py | 99 |
5 files changed, 0 insertions, 576 deletions
diff --git a/src/workflow/tests/__init__.py b/src/workflow/tests/__init__.py deleted file mode 100644 index 4f0437d..0000000 --- a/src/workflow/tests/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -############################################################################## -# Copyright (c) 2018 Parker Berberian, Sawyer Bergeron and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## diff --git a/src/workflow/tests/constants.py b/src/workflow/tests/constants.py deleted file mode 100644 index f94a949..0000000 --- a/src/workflow/tests/constants.py +++ /dev/null @@ -1,198 +0,0 @@ -############################################################################## -# Copyright (c) 2018 Parker Berberian, Sawyer Bergeron, and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## -POD_XML = """<mxGraphModel> -<root> -<mxCell id="0"/> -<mxCell id="1" parent="0"/> -<mxCell id="host_null" value="Test profile 0" style="editable=0" vertex="1" connectable="0" parent="1"> -<mxGeometry x="75" y="150" width="110" height="90" as="geometry"/> -</mxCell> -<mxCell id="2" value="eno0" style="fillColor=blue;editable=0" vertex="1" parent="host_null"> -<mxGeometry x="90" y="5" width="20" height="20" as="geometry"/> -</mxCell> -<mxCell id="3" value="eno1" style="fillColor=blue;editable=0" vertex="1" parent="host_null"> -<mxGeometry x="90" y="30" width="20" height="20" as="geometry"/> -</mxCell> -<mxCell id="4" value="eno2" style="fillColor=blue;editable=0" vertex="1" parent="host_null"> -<mxGeometry x="90" y="55" width="20" height="20" as="geometry"/> -</mxCell> -<mxCell id="5" value="Test profile 3" style="editable=0" vertex="1" connectable="0" parent="1"> -<mxGeometry x="75" y="290" width="110" height="90" as="geometry"/> -</mxCell> -<mxCell id="6" value="eno0" style="fillColor=blue;editable=0" vertex="1" parent="5"> -<mxGeometry x="90" y="5" width="20" height="20" as="geometry"/> -</mxCell> -<mxCell id="7" value="eno1" style="fillColor=blue;editable=0" vertex="1" parent="5"> -<mxGeometry x="90" y="30" width="20" height="20" as="geometry"/> -</mxCell> -<mxCell id="8" value="eno2" style="fillColor=blue;editable=0" vertex="1" parent="5"> -<mxGeometry x="90" y="55" width="20" height="20" as="geometry"/> -</mxCell> -<mxCell id="network_0" value="{"vlan_id":"500","name":"net"}" style="fillColor=red" vertex="1" parent="1"> -<mxGeometry x="400" y="-20" width="10" height="2000" as="geometry"/> -</mxCell> -<mxCell id="9" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="10" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.02" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="11" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.04" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="12" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.06" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="13" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.08" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="14" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.1" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="15" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.12" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="16" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.14" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="17" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.16" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="18" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.18" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="19" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.2" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="20" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.22" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="21" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.24" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="22" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.26" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="23" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.28" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="24" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.3" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="25" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.32" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="26" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.34" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="27" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.36" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="28" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.38" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="29" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.4" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="30" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.42" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="31" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.44" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="32" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.46" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="33" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.48" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="34" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.5" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="35" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.52" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="36" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.54" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="37" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.56" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="38" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.58" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="39" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.6" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="40" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.62" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="41" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.64" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="42" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.66" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="43" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.68" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="44" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.7000000000000001" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="45" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.72" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="46" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.74" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="47" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.76" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="48" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.78" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="49" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.8" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="50" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.8200000000000001" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="51" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.84" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="52" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.86" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="53" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.88" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="54" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.9" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="55" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.92" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="56" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.9400000000000001" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="57" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.96" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="58" value="" style="fillColor=black;opacity=0" vertex="1" parent="network_0"> -<mxGeometry y="0.98" width="10" height="40" relative="1" as="geometry"/> -</mxCell> -<mxCell id="59" value="{"tagged":true}" style="strokeColor=red" edge="1" parent="1" source="2" target="13"> -<mxGeometry relative="1" as="geometry"/> -</mxCell> -<mxCell id="60" value="{"tagged":false}" style="strokeColor=red" edge="1" parent="1" source="7" target="17"> -<mxGeometry relative="1" as="geometry"/> -</mxCell> -</root> -</mxGraphModel> -""" diff --git a/src/workflow/tests/test_fixtures.py b/src/workflow/tests/test_fixtures.py deleted file mode 100644 index fe16be7..0000000 --- a/src/workflow/tests/test_fixtures.py +++ /dev/null @@ -1,2 +0,0 @@ - -MX_GRAPH_MODEL = '<mxGraphModel><root><mxCell id="0"/><mxCell id="1" parent="0"/><mxCell id="host_c" value="{"name":"c","description":"Intel based ProLiant server from HPE"}" style="editable=0" parent="1" vertex="1" connectable="0"><mxGeometry x="75" y="150" width="110" height="175" as="geometry"><mxPoint x="-50" as="offset"/></mxGeometry></mxCell><mxCell id="2" value="{"name":"ens4f1","description":"speed: 10000M type: onboard"}" style="fillColor=blue;editable=0" parent="host_c" vertex="1"><mxGeometry x="90" y="12" width="20" height="20" as="geometry"><mxPoint x="-26" as="offset"/></mxGeometry></mxCell><mxCell id="3" value="{"name":"ens4f0","description":"speed: 10000M type: onboard"}" style="fillColor=blue;editable=0" parent="host_c" vertex="1"><mxGeometry x="90" y="37" width="20" height="20" as="geometry"><mxPoint x="-26" as="offset"/></mxGeometry></mxCell><mxCell id="4" value="{"name":"ens1f2","description":"speed: 10000M type: onboard"}" style="fillColor=blue;editable=0" parent="host_c" vertex="1"><mxGeometry x="90" y="62" width="20" height="20" as="geometry"><mxPoint x="-26" as="offset"/></mxGeometry></mxCell><mxCell id="5" value="{"name":"ens1f1","description":"speed: 10000M type: onboard"}" style="fillColor=blue;editable=0" parent="host_c" vertex="1"><mxGeometry x="90" y="87" width="20" height="20" as="geometry"><mxPoint x="-26" as="offset"/></mxGeometry></mxCell><mxCell id="6" value="{"name":"ens1f0","description":"speed: 10000M type: onboard"}" style="fillColor=blue;editable=0" parent="host_c" vertex="1"><mxGeometry x="90" y="112" width="20" height="20" as="geometry"><mxPoint x="-26" as="offset"/></mxGeometry></mxCell><mxCell id="7" value="{"name":"eno49","description":"speed: 10000M type: onboard"}" style="fillColor=blue;editable=0" parent="host_c" vertex="1"><mxGeometry x="90" y="137" width="20" height="20" as="geometry"><mxPoint x="-22" as="offset"/></mxGeometry></mxCell><mxCell id="network_0" value="{"name":"public","public":true}" style="fillColor=red" parent="1" vertex="1"><mxGeometry x="400" y="-10" width="10" height="1700" as="geometry"/></mxCell><mxCell id="8" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="9" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.022222222222222223" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="10" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.044444444444444446" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="11" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.06666666666666667" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="12" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.08888888888888889" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="13" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.11111111111111112" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="14" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.13333333333333333" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="15" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.15555555555555556" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="16" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.17777777777777778" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="17" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.2" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="18" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.22222222222222224" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="19" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.24444444444444446" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="20" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.26666666666666666" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="21" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.2888888888888889" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="22" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.3111111111111111" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="23" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.33333333333333337" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="24" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.35555555555555557" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="25" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.37777777777777777" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="26" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.4" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="27" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.4222222222222222" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="28" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.4444444444444445" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="29" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.4666666666666667" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="30" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.48888888888888893" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="31" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.5111111111111112" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="32" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.5333333333333333" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="33" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.5555555555555556" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="34" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.5777777777777778" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="35" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.6" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="36" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.6222222222222222" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="37" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.6444444444444445" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="38" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.6666666666666667" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="39" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.6888888888888889" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="40" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.7111111111111111" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="41" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.7333333333333334" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="42" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.7555555555555555" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="43" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.7777777777777778" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="44" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.8" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="45" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.8222222222222223" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="46" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.8444444444444444" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="47" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.8666666666666667" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="48" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.888888888888889" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="49" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.9111111111111111" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="50" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.9333333333333333" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="51" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.9555555555555556" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="52" value="" style="fillColor=black;opacity=0" parent="network_0" vertex="1"><mxGeometry y="0.9777777777777779" width="10" height="37.77777777777778" relative="1" as="geometry"/></mxCell><mxCell id="53" value="{"tagged":false}" style="strokeColor=red" parent="1" source="2" target="13" edge="1"><mxGeometry relative="1" as="geometry"/></mxCell></root></mxGraphModel>' diff --git a/src/workflow/tests/test_steps.py b/src/workflow/tests/test_steps.py deleted file mode 100644 index 57bf6a3..0000000 --- a/src/workflow/tests/test_steps.py +++ /dev/null @@ -1,269 +0,0 @@ -############################################################################## -# Copyright (c) 2018 Parker Berberian, Sawyer Bergeron, and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -""" -This file tests basic functionality of each step class. - -More in depth case coverage of WorkflowStep.post() must happen elsewhere. -""" - -import json -from unittest import SkipTest, mock - -from django.test import TestCase, RequestFactory -from dashboard.testing_utils import make_lab, make_user, make_os,\ - make_complete_host_profile, make_opnfv_role, make_image, make_grb,\ - make_config_bundle, make_host, make_user_profile, make_generic_host -from workflow import resource_bundle_workflow -from workflow import booking_workflow -from workflow import sw_bundle_workflow -from workflow.models import Repository -from workflow.tests import test_fixtures - - -class TestConfig: - """ - Basic class to instantiate and hold reference. - - to models we will need often - """ - - def __init__(self, usr=None): - self.lab = make_lab() - self.user = usr or make_user() - self.os = make_os() - self.host_prof = make_complete_host_profile(self.lab) - self.host = make_host(self.host_prof, self.lab, name="host1") - - # pod description as required by testing lib - self.topology = { - "host1": { - "type": self.host_prof, - "role": make_opnfv_role(), - "image": make_image(self.lab, 3, self.user, self.os, self.host_prof), - "nets": [ - [{"name": "public", "tagged": True, "public": True}] - ] - } - } - self.grb = make_grb(self.topology, self.user, self.lab)[0] - self.generic_host = make_generic_host(self.grb, self.host_prof, "host1") - - -class StepTestCase(TestCase): - - # after setUp is called, this should be an instance of a step - step = None - - post_data = {} # subclasses will set this - - @classmethod - def setUpTestData(cls): - super().setUpTestData() - cls.factory = RequestFactory() - cls.user_prof = make_user_profile() - cls.user = cls.user_prof.user - - def setUp(self): - super().setUp() - if self.step is None: - raise SkipTest("Step instance not given") - repo = Repository() - self.add_to_repo(repo) - self.step = self.step(1, repo) - - def assertCorrectPostBehavior(self, post_data): - """ - Stub for validating step behavior on POST request. - - allows subclasses to override and make assertions about - the side effects of self.step.post() - post_data is the data passed into post() - """ - return - - def add_to_repo(self, repo): - """ - Stub for modifying the step's repo. - - This method is a hook that allows subclasses to modify - the contents of the repo before the step is created. - """ - return - - def assertValidHtml(self, html_str): - """ - Assert that html_str is a valid html fragment. - - However, I know of no good way of doing this in python - """ - self.assertTrue(isinstance(html_str, str)) - self.assertGreater(len(html_str), 0) - - def test_render_to_string(self): - request = self.factory.get("/workflow/manager/") - request.user = self.user - response_html = self.step.render_to_string(request) - self.assertValidHtml(response_html) - - def test_post(self, data=None): - post_data = data or self.post_data - self.step.post(post_data, self.user) - self.assertCorrectPostBehavior(data) - - -class SelectStepTestCase(StepTestCase): - # ID of model to be sent to the step's form - # can be an int or a list of ints - obj_id = -1 - - def setUp(self): - super().setUp() - - try: - iter(self.obj_id) - except TypeError: - self.obj_id = [self.obj_id] - - field_data = json.dumps(self.obj_id) - self.post_data = { - "searchable_select": [field_data] - } - - -class DefineHardwareTestCase(StepTestCase): - step = resource_bundle_workflow.Define_Hardware - post_data = { - "filter_field": { - "lab": { - "lab_35": {"selected": True, "id": 35}}, - "host": { - "host_1": {"selected": True, "id": 1}} - } - } - - -class DefineNetworkTestCase(StepTestCase): - step = resource_bundle_workflow.Define_Nets - post_data = {"xml": test_fixtures.MX_GRAPH_MODEL} - - -class ResourceMetaTestCase(StepTestCase): - step = resource_bundle_workflow.Resource_Meta_Info - post_data = { - "bundle_name": "my_bundle", - "bundle_description": "My Bundle" - } - - -class BookingResourceTestCase(SelectStepTestCase): - step = booking_workflow.Booking_Resource_Select - - def add_to_repo(self, repo): - repo.el[repo.SESSION_USER] = self.user - - @classmethod - def setUpTestData(cls): - super().setUpTestData() - conf = TestConfig(usr=cls.user) - cls.obj_id = conf.grb.id - - -class SoftwareSelectTestCase(SelectStepTestCase): - step = booking_workflow.SWConfig_Select - - def add_to_repo(self, repo): - repo.el[repo.SESSION_USER] = self.user - repo.el[repo.SELECTED_RESOURCE_TEMPLATE] = self.conf.grb - - @classmethod - def setUpTestData(cls): - super().setUpTestData() - cls.conf = TestConfig(usr=cls.user) - host_map = {"host1": cls.conf.generic_host} - config_bundle = make_config_bundle(cls.conf.grb, cls.conf.user, cls.conf.topology, host_map)[0] - cls.obj_id = config_bundle.id - - -class OPNFVSelectTestCase(SelectStepTestCase): - step = booking_workflow.OPNFV_Select - - def add_to_repo(self, repo): - repo.el[repo.SELECTED_CONFIG_BUNDLE] = self.config_bundle - - @classmethod - def setUpTestData(cls): - super().setUpTestData() - conf = TestConfig(usr=cls.user) - host_map = {"host1": conf.generic_host} - cls.config_bundle, opnfv_config = make_config_bundle(conf.grb, conf.user, conf.topology, host_map) - cls.obj_id = opnfv_config.id - - -class BookingMetaTestCase(StepTestCase): - step = booking_workflow.Booking_Meta - post_data = { - "length": 14, - "purpose": "Testing", - "project": "Lab as a Service", - "users": ["[-1]"] - } - - def add_to_repo(self, repo): - repo.el[repo.SESSION_MANAGER] = mock.MagicMock() - - @classmethod - def setUpTestData(cls): - super().setUpTestData() - new_user = make_user(username="collaborator", email="different@mail.com") - new_user_prof = make_user_profile(user=new_user) - data = "[" + str(new_user_prof.id) + "]" # list of IDs - cls.post_data['users'] = [data] - - -class ConfigResourceSelectTestCase(SelectStepTestCase): - step = sw_bundle_workflow.SWConf_Resource_Select - - def add_to_repo(self, repo): - repo.el[repo.SESSION_USER] = self.user - - @classmethod - def setUpTestData(cls): - super().setUpTestData() - conf = TestConfig(usr=cls.user) - cls.obj_id = conf.grb.id - - -class DefineSoftwareTestCase(StepTestCase): - step = sw_bundle_workflow.Define_Software - post_data = { - "form-0-image": 1, - "headnode": 1, - "form-0-headnode": "", - "form-TOTAL_FORMS": 1, - "form-INITIAL_FORMS": 1, - "form-MIN_NUM_FORMS": 0, - "form-MAX_NUM_FORMS": 1000, - } - - def add_to_repo(self, repo): - repo.el[repo.SELECTED_RESOURCE_TEMPLATE] = self.conf.grb - - @classmethod - def setUpTestData(cls): - super().setUpTestData() - cls.conf = TestConfig(usr=cls.user) - - -class ConfigSoftwareTestCase(StepTestCase): - step = sw_bundle_workflow.Config_Software - post_data = { - "name": "config_bundle", - "description": "My Config Bundle" - } diff --git a/src/workflow/tests/test_workflows.py b/src/workflow/tests/test_workflows.py deleted file mode 100644 index 995d699..0000000 --- a/src/workflow/tests/test_workflows.py +++ /dev/null @@ -1,99 +0,0 @@ -############################################################################## -# Copyright (c) 2018 Parker Berberian, Sawyer Bergeron, and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -from unittest import SkipTest -from django.test import TestCase -from workflow.workflow_factory import WorkflowFactory - - -""" -To start a workflow: - POST to /wf/workflow {"add": <wf_type_int> - - types: - 0 - Booking - 1 - Resource - 2 - Config - -To remove a workflow: - POST to /wf/workflow {"cancel": ""} -""" - - -class WorkflowTestCase(TestCase): - - @classmethod - def setUpClass(cls): - super().setUpClass() - raise SkipTest("These tests are no good") - - def setUp(self): - self.clear_workflow() - self.create_workflow(self.wf_type) - - def create_workflow(self, wf_type): - self.clear_workflow() - - # creates workflow on backend - self.client.post("/", {"create": int(wf_type)}) # TODO: verify content type, etc - - def clear_workflow(self): - session = self.client.session - for k in session.keys(): - del session[k] - session.save() - - def render_steps(self): - """Retrieve each step individually at /wf/workflow/step=<index>.""" - for i in range(self.step_count): - # renders the step itself, not in an iframe - exception = None - try: - response = self.client.get("/wf/workflow/", {"step": str(i)}) - self.assertLess(response.status_code, 300) - except Exception as e: - exception = e - - self.assertIsNone(exception) - - -class BookingWorkflowTestCase(WorkflowTestCase): - - @classmethod - def setUpClass(cls): - super(BookingWorkflowTestCase, cls).setUpClass() - cls.step_count = len(WorkflowFactory.booking_steps) - cls.wf_type = 0 - - def test_steps_render(self): - super(BookingWorkflowTestCase, self).render_steps() - - -class ResourceWorkflowTestCase(WorkflowTestCase): - - @classmethod - def setUpClass(cls): - super(ResourceWorkflowTestCase, cls).setUpClass() - cls.step_count = len(WorkflowFactory.resource_steps) - cls.wf_type = 1 - - def test_steps_render(self): - super(ResourceWorkflowTestCase, self).render_steps() - - -class ConfigWorkflowTestCase(WorkflowTestCase): - - @classmethod - def setUpClass(cls): - super(ConfigWorkflowTestCase, cls).setUpClass() - cls.step_count = len(WorkflowFactory.config_steps) - cls.wf_type = 2 - - def test_steps_render(self): - super(ConfigWorkflowTestCase, self).render_steps() |