Skip to content

Commit

Permalink
avoiding validation error when heartbeats are received
Browse files Browse the repository at this point in the history
  • Loading branch information
mriehl committed Mar 19, 2013
1 parent 615f092 commit 646afa3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/python/yadtreceiver/events.py
Expand Up @@ -38,7 +38,8 @@
TYPE_FULL_UPDATE = 'full-update'
TYPE_REQUEST = 'request'
TYPE_SERVICE_CHANGE = 'service-change'
KNOWN_EVENT_TYPES = [TYPE_COMMAND, TYPE_FULL_UPDATE, TYPE_REQUEST, TYPE_SERVICE_CHANGE]
TYPE_HEARTBEAT = 'heartbeat'
KNOWN_EVENT_TYPES = [TYPE_COMMAND, TYPE_FULL_UPDATE, TYPE_REQUEST, TYPE_SERVICE_CHANGE, TYPE_HEARTBEAT]


class IncompleteEventDataException(Exception):
Expand Down
8 changes: 8 additions & 0 deletions src/unittest/python/event_tests.py
Expand Up @@ -64,6 +64,14 @@ def test_should_return_description_of_multiple_service_changes(self):
})
self.assertEqual(str(event), 'target[target-name] services changed: spam is up, eggs is down')

def test_should_not_complain_upon_receiving_heartbeat_events(self):
event = Event('target-name', {'id': 'heartbeat',
'type': 'event',
'target': 'dev12',
'tracking_id': None,
'payload': None})


def test_should_return_description_of_request(self):
event = Event('target-name', {'id': 'request',
'cmd': 'command',
Expand Down

0 comments on commit 646afa3

Please sign in to comment.