def test_missing_front_matter(self): ''' Should read properly with valid, minimal front matter ''' expected_body = 'Missing front matter' actual_front, actual_body = jekyll_functions.load_jekyll_doc(StringIO(expected_body)) self.assertEqual({}, actual_front) self.assertEqual(actual_body, expected_body)
def test_good_files(self): front = dict(title='Greeting'.encode('rotunicode')) body, file = u'World: Hello.'.encode('rotunicode'), StringIO() jekyll_functions.dump_jekyll_doc(front, body, file) _front, _body = jekyll_functions.load_jekyll_doc(file) self.assertEqual(_front['title'], front['title']) self.assertEqual(_body, body) file.seek(0) file.read(4) == '---\n'
def test_good_files(self): front = dict(title="Greeting".encode("rotunicode")) body, file = u"World: Hello.".encode("rotunicode"), StringIO() jekyll_functions.dump_jekyll_doc(front, body, file) _front, _body = jekyll_functions.load_jekyll_doc(file) self.assertEqual(_front["title"], front["title"]) self.assertEqual(_body, body) file.seek(0) file.read(4) == "---\n"