|
@ -1,9 +1,13 @@ |
|
|
|
|
|
from unittest import mock |
|
|
|
|
|
|
|
|
|
|
|
import rtyaml |
|
|
|
|
|
|
|
|
from sapl.crispy_layout_mixin import read_layout_from_yaml |
|
|
from sapl.crispy_layout_mixin import read_layout_from_yaml |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_read_layout_from_yaml(tmpdir): |
|
|
def test_read_layout_from_yaml(tmpdir): |
|
|
|
|
|
|
|
|
contents = ''' |
|
|
stub_content = ''' |
|
|
ModelName: |
|
|
ModelName: |
|
|
Cool Legend: |
|
|
Cool Legend: |
|
|
- name:9 place tiny |
|
|
- name:9 place tiny |
|
@ -12,10 +16,10 @@ ModelName: |
|
|
More data: |
|
|
More data: |
|
|
- equalA equalB equalC |
|
|
- equalA equalB equalC |
|
|
- highlander ''' |
|
|
- highlander ''' |
|
|
file = tmpdir.join('zzz.yaml') |
|
|
|
|
|
file.write(contents) |
|
|
|
|
|
|
|
|
|
|
|
expected = [ |
|
|
with mock.patch('sapl.crispy_layout_mixin.read_yaml_from_file') as ryff: |
|
|
|
|
|
ryff.return_value = rtyaml.load(stub_content) |
|
|
|
|
|
assert read_layout_from_yaml('....', 'ModelName') == [ |
|
|
['Cool Legend', |
|
|
['Cool Legend', |
|
|
[('name', 9), ('place', 2), ('tiny', 1)], |
|
|
[('name', 9), ('place', 2), ('tiny', 1)], |
|
|
[('field', 10), ('nature', 2)], |
|
|
[('field', 10), ('nature', 2)], |
|
@ -26,4 +30,3 @@ ModelName: |
|
|
[('highlander', 12)], |
|
|
[('highlander', 12)], |
|
|
], |
|
|
], |
|
|
] |
|
|
] |
|
|
assert read_layout_from_yaml(file.strpath, 'ModelName') == expected |
|
|
|
|
|