Commit 98e0fd03 authored by Matias Guijarro's avatar Matias Guijarro
Browse files

fix issue #2845

parent f1fa53e8
Pipeline #49865 passed with stages
in 116 minutes and 3 seconds
......@@ -1099,8 +1099,9 @@ class beacon:
break
old_properties = property_node
if old_properties is None:
properties = static.ConfigNode(device_node, key=["properties"])
properties = static.ConfigNode(device_node, path=["properties"])
device_node["properties"] = properties
device_node.save()
else:
properties = old_properties
......
......@@ -19,12 +19,13 @@ def test_tangodb_getters(beacon, dummy_tango_server):
name = "dummy"
class_name = "Dummy"
server = "dummy_tg_server"
server_instance = "dummy"
dev_name = f"{domain}.{family}.{name}"
obj_name = f"{domain}/{family}/{name}"
server_instances = ["dummy", "dummy2"]
server_name = f"{server}/{name}"
obj_names = [f"{domain}/{family}/{name}" for name in server_instances]
dev_name = [f"{domain}.{family}.{name}" for name in server_instances]
alias = "dummy_alias"
serv_name = f"{server}/{server_instance}"
dserver_name = f"dserver/{serv_name}"
serv_names = [f"{server}/{server_instance}" for server_instance in server_instances]
dserver_names = [f"dserver/{serv_name}" for serv_name in serv_names]
properties = {"dummy_property1": "dummy_value1", "dummy_property2": ""}
cls_properties = {
"dummy_cls_property1": "dummy_cls_value1",
......@@ -46,23 +47,24 @@ def test_tangodb_getters(beacon, dummy_tango_server):
assert server in result
result = db.get_server_list()
assert serv_name in result
assert all(serv_name in result for serv_name in serv_names)
result = db.get_host_server_list(host)
assert list(result) == [serv_name]
assert list(result) == [server_name]
result = db.get_host_server_list("*")
assert len(result) == 1
assert list(result) == [serv_name]
assert list(result) == [server_name]
result = db.get_instance_name_list(server)
assert list(result) == [server_instance]
assert list(result) == server_instances
result = db.get_instance_name_list("*")
assert server_instance in result
assert all(serv_instance in result for serv_instance in server_instances)
result = db.get_server_class_list(serv_name)
assert list(result) == [class_name]
for serv_name in serv_names:
result = db.get_server_class_list(serv_name)
assert list(result) == [class_name]
result = db.get_server_class_list("*")
assert class_name in result
......@@ -75,33 +77,34 @@ def test_tangodb_getters(beacon, dummy_tango_server):
assert class_name in result
assert "DServer" in result
result = db.get_device_class_list(serv_name)
assert list(result) == [obj_name, class_name]
for i, serv_name in enumerate(serv_names):
obj_name = obj_names[i]
result = db.get_device_class_list(serv_name)
assert list(result) == [obj_name, class_name]
result = db.get_device_name(serv_name, class_name)
assert list(result) == [obj_name]
result = db.get_device_name(serv_name, "*")
assert list(result) == [obj_name]
result = db.get_device_class_list("*")
assert not result
result = db.get_device_name(serv_name, class_name)
assert list(result) == [obj_name]
result = db.get_device_name("*", class_name)
assert list(result) == [obj_name]
result = db.get_device_name(serv_name, "*")
assert list(result) == [obj_name]
assert all(obj_name in result for obj_name in obj_names)
result = db.get_device_name("*", "*")
assert obj_name in result
assert all(obj_name in result for obj_name in obj_names)
result = db.get_device_exported_for_class(class_name)
assert list(result) == [obj_name]
assert list(result) == [obj_names[0]] # only first dummy server is started
result = db.get_device_exported_for_class("*")
assert obj_name in result
assert obj_names[0] in result
result = db.get_device_exported("*")
assert len(result) == 2
assert set(result) == {obj_name, dserver_name}
assert set(result) == {obj_names[0], dserver_names[0]}
result = db.get_device_family("*")
assert family in result
......@@ -109,6 +112,10 @@ def test_tangodb_getters(beacon, dummy_tango_server):
result = db.get_device_domain("*")
assert domain in result
# in next checks, only first dummy server is used
obj_name = obj_names[0]
serv_name = serv_names[0]
result = db.get_class_for_device(obj_name)
assert result == class_name
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment