Ejemplo n.º 1
0
 def test_cached_get_absolute_url_1(self):
     th = lambda:1
     th.title = 'lala-x-lala'
     p = Post(id=3, post_type='question')
     p._thread_cache = th  # cannot assign non-Thread instance directly
     self.assertEqual('/question/3/lala-x-lala/', p.get_absolute_url(thread=th))
     self.assertTrue(p._thread_cache is th)
     self.assertEqual('/question/3/lala-x-lala/', p.get_absolute_url(thread=th))
Ejemplo n.º 2
0
 def test_cached_get_absolute_url_1(self):
     th = lambda: 1
     th.title = "lala-x-lala"
     p = Post(id=3, post_type="question")
     p._thread_cache = th  # cannot assign non-Thread instance directly
     expected_url = urlresolvers.reverse("question", kwargs={"id": 3}) + th.title + "/"
     self.assertEqual(expected_url, p.get_absolute_url(thread=th))
     self.assertTrue(p._thread_cache is th)
     self.assertEqual(expected_url, p.get_absolute_url(thread=th))
Ejemplo n.º 3
0
 def test_cached_get_absolute_url_1(self):
     th = lambda:1
     th.title = 'lala-x-lala'
     p = Post(id=3, post_type='question')
     p._thread_cache = th  # cannot assign non-Thread instance directly
     expected_url = urlresolvers.reverse('question', kwargs={'id': 3}) \
                                                             + th.title + '/'
     self.assertEqual(expected_url, p.get_absolute_url(thread=th))
     self.assertTrue(p._thread_cache is th)
     self.assertEqual(expected_url, p.get_absolute_url(thread=th))
Ejemplo n.º 4
0
 def test_cached_get_absolute_url_1(self):
     th = lambda: 1
     th.title = 'lala-x-lala'
     p = Post(id=3, post_type='question')
     p._thread_cache = th  # cannot assign non-Thread instance directly
     expected_url = urlresolvers.reverse('question', kwargs={'id': 3}) \
                                                             + th.title + '/'
     self.assertEqual(expected_url, p.get_absolute_url(thread=th))
     self.assertTrue(p._thread_cache is th)
     self.assertEqual(expected_url, p.get_absolute_url(thread=th))