Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed over-nesting in resources file and added test #498

Merged
merged 2 commits into from
Aug 21, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions docs/nodes/openstack.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ title: OpenStack

Node classes list of openstack provider.

## openstack.adjacentenablers


## openstack.apiproxies

- **diagrams.openstack.apiproxies.EC2API**
Expand Down Expand Up @@ -51,9 +48,6 @@ Node classes list of openstack provider.

- **diagrams.openstack.frontend.Horizon**

## openstack.lifecyclemanagement


## openstack.monitoring

- **diagrams.openstack.monitoring.Monasca**
Expand All @@ -73,9 +67,6 @@ Node classes list of openstack provider.

- **diagrams.openstack.nfv.Tacker**

## openstack.operations


## openstack.optimization

- **diagrams.openstack.optimization.Congress**
Expand Down
14 changes: 14 additions & 0 deletions tests/test_diagram.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -283,3 +284,16 @@ def test_nodes_to_node_with_additional_attributes_directional(self):
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/module/icon.png, 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)