Example #1
0
 def test_handles_rate_limit(self):
     """
     If we happen to be rate limited, it just gives back nothing.
     """
     with app.test_request_context('/'):
         with self.mock_rate_limit():
             self.assertEqual(get_latest_tweet(app), u'')
    def test_convert_to_plain_object(self):
        """
        Converts search results to a plain Python object.
        """
        with app.test_request_context("/"):
            results = SearchIndex(bookmarks=get_bookmarks()).search("ap")

            presenter = SearchResultPresenter(results)

            result_list = presenter.to_list()

        self.assertGreater(len(result_list), 0)
Example #3
0
    def test_lookups(self):
        """
        Test bookmark, category, and location lookups.
        """
        with app.test_request_context('/'):
            self.assertIsInstance(
                get_bookmark_lookup().bookmark('apples'),
                Bookmark)

            self.assertIsInstance(
                get_bookmark_lookup().category('apples-green'),
                Category)

            self.assertIsInstance(
                get_bookmark_lookup().location('http://apples.com/tasty1.jpg'),
                Location)
Example #4
0
 def test_get_tweet(self):
     """
     Can get a tweet.
     """
     with app.test_request_context('/'):
         self.assertIsInstance(get_latest_tweet(app), unicode)