def test_delete_a_wishlist(self): """ Delete a Wishlist """ wishlist = Wishlist("fido", "1") wishlist.save() self.assertEqual(len(Wishlist.all()), 1) # delete the wishlist and make sure it isn't in the database wishlist.delete() self.assertEqual(len(Wishlist.all()), 0)
def test_key_error_on_delete(self, bad_mock): """ Test KeyError on delete """ bad_mock.side_effect = KeyError() wishlist = Wishlist("fido", "1") wishlist.create() wishlist.delete()