def test_that_models_can_be_queried(self):
        """Ensures that models can be queried.
        """
        bucketlist = Bucketlist.objects.get(name=self.title)
        bucketlist_item = BucketlistItem(name="Visit India", done=False, bucketlist=bucketlist, user_id=self.user.id)
        bucketlist_item.save()

        query_results = BucketlistItem.search("Visit India")

        self.assertIn(bucketlist_item, query_results)
    def test_that_bucket_list_item_can_be_created(self):
        """Ensures that bucketlist items can be created.
        """
        bucketlist = Bucketlist.objects.get(name=self.title)
        bucketlist_item = BucketlistItem(name="Visit India", done=False, bucketlist=bucketlist, user_id=self.user.id)
        bucketlist_item.save()

        bucketlist_item = BucketlistItem.objects.get(name="Visit India")

        self.assertEqual(bucketlist_item.done, False)
        self.assertEqual(bucketlist_item.bucketlist_id, bucketlist.id)
    def test_that_items_done_can_be_retrieved(self):
        """Ensure that items done can be retrieved
        """
        bucketlist = Bucketlist.objects.get(name=self.title)
        bucketlist_item = BucketlistItem(name="Visit India", done=False, bucketlist=bucketlist, user_id=self.user.id)
        bucketlist_item.save()

        self.assertEqual(bucketlist.num_items_done(), 0)

        bucketlist_item.done = True
        bucketlist_item.save()
        self.assertEqual(bucketlist.num_items_done(), 1)