import json

from nose.tools import eq_, raises
from mock import MagicMock, patch

from buffer.managers.updates import Updates
from buffer.models.update import Update

def test_updates_manager_pending():
  '''
    Test basic pending updates retreiving
  '''

  mocked_api = MagicMock()
  mocked_api.get.return_value = {
      'updates': [{
        'text': 'hey'
      }]
  }

  pendings = Updates(api=mocked_api, profile_id=1).pending

  mocked_api.get.assert_called_once_with(url='profiles/1/updates/pending.json')
  eq_(pendings, [Update(api=mocked_api, raw_response={'text': 'hey'})])

@@ -242,10 +242,10 @@
 retr
-e
 i
+e
 ving
@@ -509,16 +509,16 @@
 .json')%0A
-
   eq_(pe
@@ -581,8 +581,437 @@
 ey'%7D)%5D)%0A
+%0Adef test_udpates_manager_sent():%0A  '''%0A    Test basic sent updates retrieving%0A  '''%0A%0A  mocked_api = MagicMock()%0A  mocked_api.get.return_value = %7B%0A    'updates': %5B%7B%0A      'text': 'sent'%0A    %7D%5D%0A  %7D%0A%0A  sent = Updates(api=mocked_api, profile_id=1).sent%0A  assert_update = Update(api=mocked_api, raw_response=%7B'text': 'sent'%7D)%0A%0A  mocked_api.get.assert_called_once_with(url='profiles/1/updates/sent.json')%0A  eq_(sent, %5Bassert_update%5D)%0A

Test sent updates retrieving