def setUpClass(cls):
        # Create User
        cls.user = User.objects.create_user(username="******",
                                            password="******")
        cls.user.save()
        cls.u_id = cls.user.id

        # Grab Uncategorized Topic
        cls.user_uncat = cls.user.topics.get(name="Uncategorized")

        # Create other topics
        cls.t1_m = Topic(name="sonnets", user=cls.user)
        cls.t2_m = Topic(name="tragedies", user=cls.user)
        cls.evil_t1_m = Topic(name="tragedies", user=cls.user)

        # Turn topics into JSON objects
        cls.t1_data = model_to_dict(cls.t1_m)
        cls.t2_data = model_to_dict(cls.t2_m)
        cls.evil_t1_data = model_to_dict(cls.evil_t1_m)
    def setUpClass(cls):
        # Create User
        cls.user = User.objects.create_user(username="******",
                                            password="******")
        cls.user.save()
        cls.u_id = cls.user.id

        # Grab Uncategorized Topic
        cls.user_uncat = cls.user.topics.get(name="Uncategorized")

        # Create other topics
        cls.t1_m = Topic(name="sonnets", user=cls.user)
        cls.t1_m.save()
        cls.t1_id = cls.t1_m.id

        cls.t2_m = Topic(name="tragedies", user=cls.user)
        cls.t2_m.save()
        cls.t2_id = cls.t2_m.id

        cls.evil_t1_m = Topic(name="tragedies", user=cls.user)
        cls.evil_t1_id = 154  # shakespeare wrote this many sonnets! <- Be more subtle Lucia, let the reader figure it out

        # Turn topics into JSON objects
        cls.evil_t1_data = model_to_dict(cls.evil_t1_m)
    def test_search_feeds_and_topics(cls):
        """Topics exist - the search should search Topics and Feeds, and return a list of Feeds"""
        #init "videogames" Topic, with f1 and f2
        webcomics = Topic(name="webcomics", user=cls.user)
        webcomics.save()

        # Add NYT's Golf RSS to webcomics
        webcomics.feeds.add(cls.f5_m)

        #Topic and f2 and f4 fields both contain word "webcomic"
        #NYT, by virtue of being under "webcomic" is returned
        response = cls.client.post("/search/", {"searchString": "webcomic"})
        cls.assertEqual(response.status_code, 200)
        #cls.assertItemsEqual(response.data, [cls.f3, cls.f4, cls.f5])
        cls.assertTrue(cls.f3 in response.data)
        cls.assertTrue(cls.f4 in response.data)
        cls.assertTrue(cls.f5 in response.data)