Skip to content

Commit

Permalink
Add test_commection to manager
Browse files Browse the repository at this point in the history
  • Loading branch information
hmpf committed Jun 11, 2024
1 parent 34e7faf commit 2107947
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/zinolib/controllers/zino1.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,19 @@ def get_events(self):
continue
self.events[event_id] = event

def test_connection(self):
"""Try fetching info about a non-existing event
If the connection is up, we get a ProtocolError due to the
non-existent event. Do nothing.
If the connection is down we will pass on a TimeoutError.
"""
try:
self._event_adapter.get_attrlist(self.session.request, 0)
except ProtocolError:
pass

def create_event_from_id(self, event_id: int):
self._verify_session()
attrlist = self.rename_exception(self._event_adapter.get_attrlist, self.session.request, event_id)
Expand Down

0 comments on commit 2107947

Please sign in to comment.