Пример #1
0
 def test_non_existent_attributes(self):
     """
     Test accessing attributes that do not exits
     """
     head = ''
     body = '<h1>Hello World</h2>'
     url = '/one/two/three/hello-world.html'
     modified_time = 23233232
     site = None
     page = Site.create_page(head, body, url, modified_time, site)
     assert page['title'] is ''
Пример #2
0
 def test_body_classes(self):
     """
     Test css classes for the HTML body tag
     """
     head = "title: Hello World\nkeywords: abc, 1234, xyx\nlist: [1, 2, 3]" \
            "\ntemplate: index"
     body = '<h1>Hello World</h2>'
     url = '/one/two/three/hello-world.html'
     modified_time = 23233232
     site = None
     page = Site.create_page(head, body, url, modified_time, site)
     assert page.body_classes() == 'index'
Пример #3
0
 def test_html(self):
     """
     Test html body content
     """
     head = "title: 'Hello World'"
     body = '<h1>Hello World</h2>'
     url = '/one/two/three/hello-world.html'
     modified_time = 23233232
     site = None
     page = Site.create_page(head, body, url, modified_time, site)
     assert page['title'] == 'Hello World'
     assert page.html == '<h1>Hello World</h2>'
Пример #4
0
 def test_page_creation(self):
     """
     Test a page gets created based on its 'type' field.
     """
     head = "title: 'Hello World'\ntype: Page"
     body = '<h1>Hello World</h2>'
     url = '/one/two/three/hello-world.html'
     modified_time = 23233232
     site = None
     page = Site.create_page(head, body, url, modified_time, site)
     self.assertEquals(Page, type(page))
     assert page['title'] == 'Hello World'
     assert page.html == '<h1>Hello World</h2>'
Пример #5
0
 def test_attributes(self):
     """
     Test accessing attributes in the YAML header
     """
     yml_head = "title: Hello World\nkeywords: abc, 1234, xyx\nlist: [1, 2, 3]"
     body = '<h1>Hello World</h2>'
     url = '/one/two/three/hello-world.html'
     modified_time = 23233232
     site = None
     page = Site.create_page(yml_head, body, url, modified_time, site)
     assert page['title'] == 'Hello World'
     assert page['keywords'] == 'abc, 1234, xyx'
     assert page['list'][0] == 1
     assert page['list'][1] == 2
     assert page['list'][2] == 3