|
| 1 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 2 | +# you may not use this file except in compliance with the License. |
| 3 | +# You may obtain a copy of the License at |
| 4 | +# |
| 5 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 6 | +# |
| 7 | +# Unless required by applicable law or agreed to in writing, software |
| 8 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 9 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 10 | +# See the License for the specific language governing permissions and |
| 11 | +# limitations under the License. |
| 12 | + |
| 13 | + |
| 14 | +"""Ensure the expected behaviour of DeploymentView.""" |
| 15 | + |
| 16 | + |
| 17 | +from structurizr.view.container_view import ContainerView, ContainerViewIO |
| 18 | + |
| 19 | + |
| 20 | +def test_external_system_boundary_preserved(): |
| 21 | + """Test the externalSoftwareSystemBoundariesVisible flag appears in the JSON. |
| 22 | + Not having this set means that Structurizr assumes it is false (see |
| 23 | + https://github.com/Midnighter/structurizr-python/issues/67). When exported |
| 24 | + from Structurizr, the flag is present whether true or false, so check that |
| 25 | + is also the case here. |
| 26 | + """ |
| 27 | + view = ContainerView( |
| 28 | + key="key", |
| 29 | + description="description", |
| 30 | + external_software_system_boundary_visible=True, |
| 31 | + ) |
| 32 | + json = ContainerViewIO.from_orm(view).json() |
| 33 | + assert '"externalSoftwareSystemBoundariesVisible": true' in json |
| 34 | + |
| 35 | + view = ContainerView( |
| 36 | + key="key", |
| 37 | + description="description", |
| 38 | + external_software_system_boundary_visible=False, |
| 39 | + ) |
| 40 | + json = ContainerViewIO.from_orm(view).json() |
| 41 | + assert '"externalSoftwareSystemBoundariesVisible": false' in json |
0 commit comments