示例#1
0
  def test_remove_favorite_works(self):
    models.Favorite(favorite_id=101, user_id=42,
                    retailer=models.Retailer.TARGET).save()
    models.Favorite(favorite_id=102, user_id=42,
                    retailer=models.Retailer.MACYS).save()

    views.remove_favorite(StubRequest(user_id=42, retailer=models.Retailer.TARGET),
                          next_id_func=self.next_id_func)
    self.assertEqual(models.Retailer.MACYS, models.Favorite.objects.get().retailer)
示例#2
0
 def test_remove_favorite_is_noop_if_not_exists(self):
   views.remove_favorite(StubRequest(user_id=42, retailer=models.Retailer.TARGET),
                         next_id_func=self.next_id_func)
   self.assertEqual(0, models.Favorite.objects.count())