'call delete view with valid user and favorite id.
then call again to check for idempotent.'

def test_delete_favorite_view(self):

    self.client.login(username=self.adm_un, password=self.adm_pw)
    response = self._get_response('add_favorite_document', ('1',))
    favorites = Favorite.objects.all()
    self.assertEqual(favorites.count(), 1)
    ct = ContentType.objects.get_for_model(Document)
    self.assertEqual(favorites[0].content_type, ct)
    favorite_pk = favorites[0].pk
    response = self._get_response('delete_favorite', (favorite_pk,))
    favorites = Favorite.objects.all()
    self.assertEqual(favorites.count(), 0)
    self.assertEqual(response.status_code, 200)
    json_content = json.loads(response.content)
    self.assertEqual(json_content['has_favorite'], 'false')
    response2 = self._get_response('delete_favorite', (favorite_pk,))
    favorites2 = Favorite.objects.all()
    self.assertEqual(favorites2.count(), 0)
    self.assertEqual(response2.status_code, 200)
    json_content2 = json.loads(response2.content)
    self.assertEqual(json_content2['has_favorite'], 'false')
