- Removed setUp method from test_event_parse - let the parent setUp run and properly start the daemon

- More resilient logic in case some entries in the Zeroconf registry are still loading and the info object is still None
This commit is contained in:
Fabio Manganiello 2021-02-27 20:51:48 +01:00
parent 36fdcf6963
commit 0d806eeb6e
2 changed files with 5 additions and 7 deletions

View file

@ -25,7 +25,7 @@ class ZeroconfListener(zeroconf.ServiceListener):
@staticmethod @staticmethod
def parse_service_info(info: ServiceInfo) -> dict: def parse_service_info(info: ServiceInfo) -> dict:
return { return {
'addresses': [socket.inet_ntoa(addr) for addr in info.addresses], 'addresses': [socket.inet_ntoa(addr) for addr in info.addresses if info and info.addresses],
'port': info.port, 'port': info.port,
'host_ttl': info.host_ttl, 'host_ttl': info.host_ttl,
'other_ttl': info.other_ttl, 'other_ttl': info.other_ttl,

View file

@ -9,9 +9,7 @@ from . import BaseTest, conf_dir
class TestEventParse(BaseTest): class TestEventParse(BaseTest):
config_file = os.path.join(conf_dir, 'test_http_config.yaml') config_file = os.path.join(conf_dir, 'test_http_config.yaml')
condition = EventCondition.build({
def setUp(self):
self.condition = EventCondition.build({
'type': 'platypush.message.event.ping.PingEvent', 'type': 'platypush.message.event.ping.PingEvent',
'message': 'This is (the)? answer: ${answer}' 'message': 'This is (the)? answer: ${answer}'
}) })