def test_ioc_to_dict(self): ioc = IOC("SIMPLE1") macros = {"macro1": {'value': 123}, "macro2": {'value': "Hello"}} ioc.macros = macros d = ioc.to_dict() self.assertTrue("name" in d) self.assertTrue("macros" in d) macrotest = {"name" : "macro1", "value" : 123} self.assertTrue(macrotest in d["macros"]) macrotest = {"name" : "macro2", "value" : "Hello"} self.assertTrue(macrotest in d["macros"])
def make_iocs(): iocs = OrderedDict() SIM_LEVELS = ['recsim', 'devsim'] for i in range(1, 3): iocs["TESTIOC" + str(i)] = IOC("TESTIOC" + str(i)) iocs["TESTIOC" + str(i)].autostart = True iocs["TESTIOC" + str(i)].restart = False iocs["TESTIOC" + str(i)].simlevel = SIM_LEVELS[i-1] iocs["TESTIOC" + str(i)].macros["TESTIOC1MACRO"] = {"value": i} iocs["TESTIOC" + str(i)].macros["TESTIOC2MACRO"] = {"value": i} iocs["TESTIOC" + str(i)].pvs["TESTIOC1PV"] = {"value": i} iocs["TESTIOC" + str(i)].pvs["TESTIOC2PV"] = {"value": i} iocs["TESTIOC" + str(i)].pvsets["TESTIOC1PVSET"] = {"enabled": True} iocs["TESTIOC" + str(i)].pvsets["TESTIOC2PVSET"] = {"enabled": True} return iocs