def test_autocomplete_suggestion(self):
     """ Test of autocomplete function. """
     G(TestModelPost, title="This is a test post.", slug="", author=self.staff)
     G(TestModelPost, title="post.", slug="", author=self.staff)
     G(TestModelPost, title="This is a test python.", slug="", author=self.staff)
     G(TestModelPost, title="This is a poster.", slug="", author=self.staff)
     G(TestModelPost, title="This is a test poster.", slug="", author=self.staff)
     G(TestModelPost, title="This poster is a test python.", slug="", author=self.staff)
     G(TestModelPost, title="This is a test posterise.", slug="", author=self.staff)
     self.assertEquals(autocomplete_suggestion('post', 10), set(['poster', 'post', 'posterise']))
 def test_novalue_autocomplete_suggestion(self):
     """ Test to check no of results returned for autocomplete_suggestion. """
     for title in range(0, 20):
         G(TestModelPost, title="post%s" % title, slug="", author=self.staff)
     self.assertEquals(len(autocomplete_suggestion('', 10)), 0)
 def test_autocomplete_suggestion_no_of_results(self):
     """ Test to check returned result for autocomplete_suggestion has the correct no of results. """
     for title in range(0, 20):
         G(TestModelPost, title="post%s" % title, slug="", author=self.staff)
     self.assertEquals(len(autocomplete_suggestion('post', 10)), 10)