- 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
def parse_service_info(info: ServiceInfo) -> dict:
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,
'host_ttl': info.host_ttl,
'other_ttl': info.other_ttl,

View file

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