fix: removed over-nesting in resources file and added test (#498)

* Removed over-nesting in resources file and added test

* Update test_diagram.py

updated doc string of test function
pull/322/merge
lrjball 4 years ago committed by GitHub
parent c9e581098d
commit e43c860732
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -5,9 +5,6 @@ title: OpenStack
Node classes list of openstack provider.
## openstack.adjacentenablers
## openstack.apiproxies
- **diagrams.openstack.apiproxies.EC2API**
@ -51,9 +48,6 @@ Node classes list of openstack provider.
- **diagrams.openstack.frontend.Horizon**
## openstack.lifecyclemanagement
## openstack.monitoring
- **diagrams.openstack.monitoring.Monasca**
@ -73,9 +67,6 @@ Node classes list of openstack provider.
- **diagrams.openstack.nfv.Tacker**
## openstack.operations
## openstack.optimization
- **diagrams.openstack.optimization.Congress**

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

@ -1,6 +1,7 @@
import os
import shutil
import unittest
import pathlib
from diagrams import Cluster, Diagram, Edge, Node
from diagrams import getcluster, getdiagram, setcluster, setdiagram
@ -283,3 +284,16 @@ class EdgeTest(unittest.TestCase):
self.assertEqual(
nodes << Edge(color="green", label="6.3") << Edge(color="pink", label="6.4") << node1, node1
)
class ResourcesTest(unittest.TestCase):
def test_folder_depth(self):
"""
The code currently only handles resource folders up to a dir depth of 2
i.e. resources/<provider>/<type>/<image>, so check that this depth isn't
exceeded.
"""
resources_dir = pathlib.Path(__file__).parent.parent / 'resources'
max_depth = max(os.path.relpath(d, resources_dir).count(os.sep) + 1
for d, _, _ in os.walk(resources_dir))
self.assertLessEqual(max_depth, 2)

Loading…
Cancel
Save