Updated api client to do automatic json parsing. Updated tests to reflect that as well

This commit is contained in:
Rudi Grinberg 2012-10-30 15:19:51 -04:00
parent 232bbd2bb7
commit 59c55ae27f
3 changed files with 7 additions and 5 deletions

View file

@ -1,4 +1,5 @@
import unittest
import json
from mock import patch, MagicMock
from configobj import ConfigObj
from .. api_client import RequestProvider
@ -18,7 +19,7 @@ class TestRequestProvider(unittest.TestCase):
self.assertTrue( meth in rp )
def test_notify_webstream_data(self):
ret = 'testing'
ret = json.dumps( {u'testing' : u'123' } )
rp = RequestProvider(self.cfg)
read = MagicMock()
read.read = MagicMock(return_value=ret)
@ -26,6 +27,6 @@ class TestRequestProvider(unittest.TestCase):
mock_method.return_value = read
response = rp.notify_webstream_data(media_id=123)
mock_method.called_once_with(media_id=123)
self.assertEquals(ret, response)
self.assertEquals(json.loads(ret), response)
if __name__ == '__main__': unittest.main()