def test_update(self): delicious.update() # Check that the calls to the API match what we expect FakeClient.assert_called_with(settings.DELICIOUS_USERNAME, settings.DELICIOUS_PASSWORD) FakeClient.posts.update.assert_called_with() FakeClient.posts.dates.assert_called_with() FakeClient.posts.get.assert_called_with(dt='2009-08-18') # Check that the bookmark exists b = Bookmark.objects.get(url="http://jacobian.org/") self.assertEqual(b.description, "Me!") # Check that the Item exists i = Item.objects.get(content_type__model='bookmark', object_id=b.pk) self.assertEqual(i.timestamp.date(), datetime.date(2009, 8, 18)) self.assertEqual(i.tags, 'me jacob jacobian')
def test_update_skipped_second_time(self, mocked): delicious.update() delicious.update() self.assert_(mocked.info.called)