fix transport and display of node-properties

Change-Id: I35a3021768e386a5ce922c8e24128d0bc3a039be
This commit is contained in:
Enrico Faulhaber
2017-09-12 16:10:22 +02:00
parent 7d5b211a0e
commit 96ac437fd3
18 changed files with 292 additions and 225 deletions

View File

@ -24,14 +24,17 @@
import pytest
import sys
sys.path.insert(0, sys.path[0]+'/..')
sys.path.insert(0, sys.path[0] + '/..')
from collections import OrderedDict
from secop.client.baseclient import Client
# define Test-only connection object
class TestConnect(object):
callbacks = []
def writeline(self, line):
pass
@ -49,35 +52,37 @@ def clientobj(request):
print (" TEARDOWN ClientObj")
def test_describing_data_decode(clientobj):
assert OrderedDict([('a',1)]) == clientobj._decode_list_to_ordereddict(['a',1])
assert {'modules':{}, 'properties':{}} == clientobj._decode_substruct(['modules'],{})
describing_data = {'equipment_id': 'eid',
'modules': ['LN2', {'commands': [],
'interfaces': ['Readable', 'Module'],
'parameters': ['value', {'datatype': ['double'],
'description': 'current value',
def test_describing_data_decode(clientobj):
assert OrderedDict(
[('a', 1)]) == clientobj._decode_list_to_ordereddict(['a', 1])
assert {'modules': {}, 'properties': {}
} == clientobj._decode_substruct(['modules'], {})
describing_data = {'equipment_id': 'eid',
'modules': ['LN2', {'commands': [],
'interfaces': ['Readable', 'Module'],
'parameters': ['value', {'datatype': ['double'],
'description': 'current value',
'readonly': True,
}
]
}
]
}
decoded_data = {'modules': {'LN2': {'commands': {},
'parameters': {'value': {'datatype': ['double'],
'description': 'current value',
}
]
}
]
}
decoded_data = {'modules': {'LN2': {'commands': {},
'parameters': {'value': {'datatype': ['double'],
'description': 'current value',
'readonly': True,
}
},
}
},
'properties': {'interfaces': ['Readable', 'Module']}
}
},
}
},
'properties': {'equipment_id': 'eid',
}
}
}
}
a = clientobj._decode_substruct(['modules'], describing_data)
for modname, module in a['modules'].items():
a['modules'][modname] = clientobj._decode_substruct(['parameters', 'commands'], module)
a['modules'][modname] = clientobj._decode_substruct(
['parameters', 'commands'], module)
assert a == decoded_data