Skip to content
This repository was archived by the owner on Mar 13, 2022. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions watch/watch_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,24 @@ def test_unmarshal_with_custom_object(self):
self.assertEqual("1", event['object']['metadata']['resourceVersion'])
self.assertEqual("1", w.resource_version)

# ref: gh-982
def test_unmarshal_with_object_literal(self):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we have the tests submitted with the fix?

from json import dumps
w = Watch()
simple_object = {'hello': 'world', 'object': {}}
object_literal = dumps(simple_object)
event = w.unmarshal_event(object_literal, 'str')
self.assertTrue(isinstance(event, str))
self.assertEqual(object_literal, event)

# ref: gh-983
def test_unmarshal_with_int_literal(self):
w = Watch()
int_literal = '1145141919'
event = w.unmarshal_event(int_literal, 'str')
self.assertTrue(isinstance(event, str))
self.assertEqual(int_literal, event)

def test_watch_with_exception(self):
fake_resp = Mock()
fake_resp.close = Mock()
Expand Down