Debian Codegraph @

ansible_collections/theforeman/foreman/tests/test_foreman_spec_helper.py

raw symbols SCIP
1 from plugins.module_utils.foreman_helper import _foreman_spec_helper
2
3
4 def test_empty_entity():
5 spec = {}
6 foreman_spec, argument_spec = _foreman_spec_helper(spec)
7 assert spec == {}
8 assert foreman_spec == {}
9 assert argument_spec == {}
10
11
12 def test_full_entity():
13 spec = {
14 'name': {},
15 'count': {'type': 'int', 'aliases': ['number']},
16 'facilities': {'type': 'list'},
17 'street': {'type': 'entity', 'flat_name': 'street_id'},
18 'quarter': {'type': 'entity', 'resource_type': 'edges'},
19 'houses': {'type': 'entity_list', 'flat_name': 'house_ids'},
20 'prices': {'type': 'nested_list', 'foreman_spec': {
21 'value': {'type': 'int'},
22 }},
23 'tenant': {'invisible': True},
24 }
25 foreman_spec, argument_spec = _foreman_spec_helper(spec)
26 assert spec == {
27 'name': {},
28 'count': {'type': 'int', 'aliases': ['number']},
29 'facilities': {'type': 'list'},
30 'street': {'type': 'entity', 'flat_name': 'street_id'},
31 'quarter': {'type': 'entity', 'resource_type': 'edges'},
32 'houses': {'type': 'entity_list', 'flat_name': 'house_ids'},
33 'prices': {'type': 'nested_list', 'foreman_spec': {
34 'value': {'type': 'int'},
35 }},
36 'tenant': {'invisible': True},
37 }
38 assert foreman_spec == {
39 'name': {},
40 'count': {'type': 'int'},
41 'facilities': {'type': 'list'},
42 'street': {'type': 'entity', 'flat_name': 'street_id', 'resource_type': 'streets'},
43 'street_id': {},
44 'quarter': {'type': 'entity', 'flat_name': 'quarter_id', 'resource_type': 'edges'},
45 'quarter_id': {},
46 'houses': {'type': 'entity_list', 'flat_name': 'house_ids', 'resource_type': 'houses'},
47 'house_ids': {'type': 'list'},
48 'prices': {'type': 'nested_list', 'foreman_spec': {'value': {'type': 'int'}}, 'ensure': False},
49 'tenant': {},
50 }
51 assert argument_spec == {
52 'name': {},
53 'count': {'type': 'int', 'aliases': ['number']},
54 'facilities': {'type': 'list'},
55 'street': {},
56 'quarter': {},
57 'houses': {'type': 'list', 'elements': 'str'},
58 'prices': {'type': 'list', 'elements': 'dict', 'options': {
59 'value': {'type': 'int'},
60 }},
61 }