def test_close_returns_None_after_creation_with_source(self):
     """CERNAlarmSystemInterfaceProxy closes after source name initialization"""
     p = CERNAlarmSystemInterfaceProxy(sourceName='Bonzo')
     self.assertEqual(None, p.close())
     self.assertEqual(True, p.sourceName is None)
     self.assertEqual(True, p.hostName is None)
     self.assertEqual(True, p.publisher is None)
     self.assertEqual(True, p.topic is None)
Exemplo n.º 2
0
 def test_close(self):
     """CERNAlarmSystemInterfaceProxy closes after default initialization"""
     p = CERNAlarmSystemInterfaceProxy()
     self.assertEqual(None, p.close())
     self.assertEqual(True, p.sourceName is None)
     self.assertEqual(True, p.hostName is None)
     self.assertEqual(True, p.publisher is None)
     self.assertEqual(True, p.topic is None)
 def test_close(self):
     """CERNAlarmSystemInterfaceProxy closes after default initialization"""
     p = CERNAlarmSystemInterfaceProxy()
     self.assertEqual(None, p.close())
     self.assertEqual(True, p.sourceName is None)
     self.assertEqual(True, p.hostName is None)
     self.assertEqual(True, p.publisher is None)
     self.assertEqual(True, p.topic is None)
Exemplo n.º 4
0
 def test_close_returns_None_after_creation_with_source(self):
     """CERNAlarmSystemInterfaceProxy closes after source name initialization"""
     p = CERNAlarmSystemInterfaceProxy(sourceName='Bonzo')
     self.assertEqual(None, p.close())
     self.assertEqual(True, p.sourceName is None)
     self.assertEqual(True, p.hostName is None)
     self.assertEqual(True, p.publisher is None)
     self.assertEqual(True, p.topic is None)
 def test_publishMessage(self):
     """CERNAlarmSystemInterfaceProxy publishes alarm after default initialization"""
     p = CERNAlarmSystemInterfaceProxy()
     msg = ASIMessage([FaultState('Family','Member',1)])
     p.publishMessage(msg)
     self.assertEqual('CMW.ALARM_SYSTEM.ALARMS.SOURCES.ALARM_SYSTEM_SOURCES',p.topic)
     self.assertEqual(True, p.publisher is not None)
     self.assertEqual('publishAlarm', p.publisher.method_calls[0][0])
     self.assertEqual(msg, p.publisher.method_calls[0][1][0])
 def test_close_returns_None_after_message_published(self):
     """CERNAlarmSystemInterfaceProxy closes after source name initialization"""
     p = CERNAlarmSystemInterfaceProxy(sourceName='Bonzo')
     p.publisher = mock.Mock()
     p.topic = 'Topic'
     self.assertEqual(None, p.close())
     self.assertEqual(True, p.sourceName is None)
     self.assertEqual(True, p.hostName is None)
     self.assertEqual(True, p.publisher is None)
     self.assertEqual(True, p.topic is None)
Exemplo n.º 7
0
 def test_publishMessage(self):
     """CERNAlarmSystemInterfaceProxy publishes alarm after default initialization"""
     p = CERNAlarmSystemInterfaceProxy()
     msg = ASIMessage([FaultState('Family', 'Member', 1)])
     p.publishMessage(msg)
     self.assertEqual(
         'CMW.ALARM_SYSTEM.ALARMS.SOURCES.ALARM_SYSTEM_SOURCES', p.topic)
     self.assertEqual(True, p.publisher is not None)
     self.assertEqual('publishAlarm', p.publisher.method_calls[0][0])
     self.assertEqual(msg, p.publisher.method_calls[0][1][0])
Exemplo n.º 8
0
 def test_close_returns_None_after_message_published(self):
     """CERNAlarmSystemInterfaceProxy closes after source name initialization"""
     p = CERNAlarmSystemInterfaceProxy(sourceName='Bonzo')
     p.publisher = mock.Mock()
     p.topic = 'Topic'
     self.assertEqual(None, p.close())
     self.assertEqual(True, p.sourceName is None)
     self.assertEqual(True, p.hostName is None)
     self.assertEqual(True, p.publisher is None)
     self.assertEqual(True, p.topic is None)
 def test_publishMessage_with_source(self):
     """CERNAlarmSystemInterfaceProxy publishes alarm after initialization with source"""
     mockAlarmPublisher.reset_mock()
     p = CERNAlarmSystemInterfaceProxy(sourceName='Bonzo')
     msg = ASIMessage([FaultState('Family','Member',1)])
     msg.sourceName = 'msgSource'
     p.publishMessage(msg)
     self.assertEqual('CMW.ALARM_SYSTEM.ALARMS.SOURCES.msgSource',p.topic)
     self.assertEqual(True, p.publisher is not None)
     self.assertEqual('publishAlarm', p.publisher.method_calls[0][0])
     self.assertEqual(msg, p.publisher.method_calls[0][1][0])
Exemplo n.º 10
0
 def test_publishMessage_with_source(self):
     """CERNAlarmSystemInterfaceProxy publishes alarm after initialization with source"""
     mockAlarmPublisher.reset_mock()
     p = CERNAlarmSystemInterfaceProxy(sourceName='Bonzo')
     msg = ASIMessage([FaultState('Family', 'Member', 1)])
     msg.sourceName = 'msgSource'
     p.publishMessage(msg)
     self.assertEqual('CMW.ALARM_SYSTEM.ALARMS.SOURCES.msgSource', p.topic)
     self.assertEqual(True, p.publisher is not None)
     self.assertEqual('publishAlarm', p.publisher.method_calls[0][0])
     self.assertEqual(msg, p.publisher.method_calls[0][1][0])
Exemplo n.º 11
0
 def test_object_initialization(self):
     """CERNAlarmSystemInterfaceProxy default initialization"""
     p = CERNAlarmSystemInterfaceProxy()
     self.assertEqual(True, p.sourceName is None)
     self.assertEqual(False, p.hostName is None)
     self.assertEqual(True, p.publisher is None)
     self.assertEqual(True, p.topic is None)
Exemplo n.º 12
0
 def test_creation_with_Bonzo(self):
     """CERNAlarmSystemInterfaceProxy initialize with given source name"""
     p = CERNAlarmSystemInterfaceProxy(sourceName='Bonzo')
     self.assertEqual(False, p.sourceName is None)
     self.assertEqual('Bonzo', p.sourceName)
     self.assertEqual(False, p.hostName is None)
     self.assertEqual(True, p.publisher is None)
     self.assertEqual(True, p.topic is None)