示例#1
0
 def test_posts_in_context(self):
     mock_template = mock.Mock()
     builder = ListPageBuilder(mock_template)
     builder._posts = ['fake post']
     builder._generate_output()
     context = mock_template.render.call_args[0][0]
     self.assertEqual(['fake post'], context['posts'])
示例#2
0
 def test_posts_in_context(self):
     mock_template = mock.Mock()
     builder = ListPageBuilder(mock_template)
     builder._posts = ['fake post']
     builder._generate_output()
     context = mock_template.render.call_args[0][0]
     self.assertEqual(['fake post'], context['posts'])
示例#3
0
 def test_blog_list_in_context(self):
     mock_template = mock.Mock()
     builder = ListPageBuilder(mock_template)
     builder._blog_list = 'fake li items'
     builder._generate_output()
     context = mock_template.render.call_args[0][0]
     self.assertEqual('fake li items', context['blog_list'])
示例#4
0
 def test_smartypants_conversion_on_title(self):
     post = self.factory.make_blog_post(title='Emdash -- Post')
     builder = ListPageBuilder(None)
     builder.add([post])
     self.assertEqual(
         '<li><a href="/a_source_file.html">Emdash &#8212; Post</a></li>',
         builder._blog_list)
示例#5
0
 def test_smartypants_conversion_on_title(self):
     post = self.factory.make_blog_post(title='Emdash -- Post')
     builder = ListPageBuilder(None)
     builder.add([post])
     self.assertEqual(
         '<li><a href="/a_source_file.html">Emdash &#8212; Post</a></li>',
         builder._blog_list)
示例#6
0
 def test_blog_list_in_context(self):
     mock_template = mock.Mock()
     builder = ListPageBuilder(mock_template)
     builder._blog_list = 'fake li items'
     builder._generate_output()
     context = mock_template.render.call_args[0][0]
     self.assertEqual('fake li items', context['blog_list'])
示例#7
0
 def test_adds_posts_to_blog_list_html(self):
     post = self.factory.make_blog_post()
     another = self.factory.make_blog_post()
     another.title = 'Another Blog Post'
     builder = ListPageBuilder(None)
     builder.add([post, another])
     self.assertEqual(
         '<li><a href="/a_source_file.html">A Blog Post</a></li>\n'
         '<li><a href="/a_source_file.html">Another Blog Post</a></li>',
         builder._blog_list)
示例#8
0
 def test_adds_posts_to_blog_list_html(self):
     post = self.factory.make_blog_post()
     another = self.factory.make_blog_post()
     another.title = 'Another Blog Post'
     builder = ListPageBuilder(None)
     builder.add([post, another])
     self.assertEqual(
         '<li><a href="/a_source_file.html">A Blog Post</a></li>\n'
         '<li><a href="/a_source_file.html">Another Blog Post</a></li>',
         builder._blog_list)
示例#9
0
 def test_holds_posts(self):
     post = self.factory.make_blog_post()
     posts = [post]
     builder = ListPageBuilder(None)
     builder.add(posts)
     self.assertEqual(posts, builder._posts)
示例#10
0
 def test_output_is_rendered(self):
     mock_template = mock.Mock()
     mock_template.render.return_value = 'fake HTML'
     builder = ListPageBuilder(mock_template)
     output = builder._generate_output()
     self.assertEqual('fake HTML', output)
示例#11
0
 def test_holds_posts(self):
     post = self.factory.make_blog_post()
     posts = [post]
     builder = ListPageBuilder(None)
     builder.add(posts)
     self.assertEqual(posts, builder._posts)
示例#12
0
 def test_output_is_rendered(self):
     mock_template = mock.Mock()
     mock_template.render.return_value = 'fake HTML'
     builder = ListPageBuilder(mock_template)
     output = builder._generate_output()
     self.assertEqual('fake HTML', output)